Access Rights

Check if an Object Exists

var exists = await dms.AccessRights.ObjectExists(id);

This allows you to check if an object exists for the given ID. However, the function only returns true if the user has at least read access to the object.

The method can also be called with a list of object IDs. true means that all requested objects exist and read access is available.

Query Permissions

var aclInfos = await dms.AccessRights.GetAccessRightsInfo(ids);

The list returned by this method contains an entry for each object that exists and for which the user has at least read access. An AclInfo (ObjectAccessRightsInfo) includes the object ID and a list of assigned permissions.

Set Permissions

Permissions are set on the specified objects to a desired state. This must be fully specified. It is not possible to add, change, or remove permissions regardless of the existing situation. It is important to ensure that at least one user or group has full access to an object. If there is no entry with full access, an error will be thrown.

var setAcl = new SetObjectAccessRightsInfo();
setAcl.ObjectGuid = documentId; // file/folder IDs are also allowed here
var acl = new List<SetAccessRightInfo>();
acl.Add(
    new SetAccessRightInfo() {
        UserGroupXid = xidOfGroupAll,
        AccessRight = AccessRight.Full
    });

var result = await dms.AccessRights.SetAccessRightsInfo(setAcl);

In this example, the document is given full access for all DMS users.

This article has been automatically translated by an AI and may therefore contain errors.

Related to