RLMPermission

@interface RLMPermission : RLMObject

A permission which can be applied to a Realm, Class, or specific Object.

Permissions are applied by adding the permission to the RLMRealmPermission singleton object, the RLMClassPermission object for the desired class, or to a user-defined RLMArray property on a specific Object instance. The meaning of each of the properties of RLMPermission depend on what the permission is applied to, and so are left undocumented here. See RLMRealmPrivileges, RLMClassPrivileges, and RLMObjectPrivileges for details about what each of the properties mean when applied to that type.

  • The Role which this Permission applies to. All users within the Role are granted the permissions specified by the fields below any objects/classes/realms which use this Permission.

    This property cannot be modified once set.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) RLMPermissionRole *_Nonnull role;
  • Whether the user can read the object to which this Permission is attached.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) _Bool canRead;
  • Whether the user can modify the object to which this Permission is attached.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) _Bool canUpdate;
  • Whether the user can delete the object to which this Permission is attached.

    This field is only applicable to Permissions attached to Objects, and not to Realms or Classes.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) _Bool canDelete;
  • Whether the user can add or modify Permissions for the object which this Permission is attached to.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) _Bool canSetPermissions;
  • Whether the user can subscribe to queries for this object type.

    This field is only applicable to Permissions attached to Classes, and not to Realms or Objects.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) _Bool canQuery;
  • Whether the user can create new objects of the type this Permission is attached to.

    This field is only applicable to Permissions attached to Classes, and not to Realms or Objects.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) _Bool canCreate;
  • Whether the user can modify the schema of the Realm which this Permission is attached to.

    This field is only applicable to Permissions attached to Realms, and not to Realms or Objects.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) _Bool canModifySchema;
  • Returns the Permission object for the named Role in the array, creating it if needed.

    This function should be used in preference to manually querying the array for the applicable Permission as it ensures that there is exactly one Permission for the given Role in the array, merging duplicates or creating and adding new ones as needed.

    Declaration

    Objective-C

    + (nonnull RLMPermission *)
    permissionForRoleNamed:(nonnull NSString *)roleName
                   inArray:
                       (nonnull RLMArray<RLMPermission *><RLMPermission> *)array;
  • Returns the Permission object for the named Role on the Realm, creating it if needed.

    This function should be used in preference to manually querying for the applicable Permission as it ensures that there is exactly one Permission for the given Role on the Realm, merging duplicates or creating and adding new ones as needed.

    Declaration

    Objective-C

    + (nonnull RLMPermission *)permissionForRoleNamed:(nonnull NSString *)roleName
                                              onRealm:(nonnull RLMRealm *)realm;
  • Returns the Permission object for the named Role on the Class, creating it if needed.

    This function should be used in preference to manually querying for the applicable Permission as it ensures that there is exactly one Permission for the given Role on the Class, merging duplicates or creating and adding new ones as needed.

    Declaration

    Objective-C

    + (nonnull RLMPermission *)permissionForRoleNamed:(nonnull NSString *)roleName
                                              onClass:(nonnull Class)cls
                                                realm:(nonnull RLMRealm *)realm;
  • Returns the Permission object for the named Role on the named class, creating it if needed.

    This function should be used in preference to manually querying for the applicable Permission as it ensures that there is exactly one Permission for the given Role on the Class, merging duplicates or creating and adding new ones as needed.

    Declaration

    Objective-C

    + (nonnull RLMPermission *)permissionForRoleNamed:(nonnull NSString *)roleName
                                         onClassNamed:(nonnull NSString *)className
                                                realm:(nonnull RLMRealm *)realm;
  • Returns the Permission object for the named Role on the object, creating it if needed.

    This function should be used in preference to manually querying for the applicable Permission as it ensures that there is exactly one Permission for the given Role on the Realm, merging duplicates or creating and adding new ones as needed.

    The given object must have a RLMArray property defined on it. If more than one such property is present, the first will be used.

    Declaration

    Objective-C

    + (nonnull RLMPermission *)permissionForRoleNamed:(nonnull NSString *)roleName
                                             onObject:(nonnull RLMObject *)object;