Access permissions

Are used to set and get a list of permissions for app items (ApplicationItem), the app (Application) itself, and files (FileItem).

For example, you can get a list of access permissions configured for an app in the following way:

const p_settings = await Application.getPermissions();
const permissions = p_settings.__permissions;

Let’s grant a user permissions to create items in an app:

const user = Context.data.__createdBy;
const permissions = new Permissions([new PermissionValue(user, [PermissionType.CREATE])]);

await Application.setPermissions(permissions);

Now let’s check whether a user has permissions to create items:

const user = Context.data.__createdBy;

await Application.hasPermission(user, PermissionType.CREATE);

Note that different types of permissions (PermissionType) are applied to different objects in the system. For instance, it is impossible to assign the creation permissions PermissionType.CREATE for an app item (not an app). Read more about access permissions in the Help Center: Access to app data.