Class Permission
A permission which can be applied to a Realm, Class, or specific Object.
Inherited Members
Namespace: Realms.Sync
Assembly: Realm.Sync.dll
Syntax
[MapTo("__Permission")]
public class Permission : RealmObject, INotifyPropertyChanged, ISchemaSource, IThreadConfined, NotificationsHelper.INotifiable
Remarks
Permissions are applied by adding the permission to the RealmPermission singleton
object, the ClassPermission object for the desired class, or to a user-defined
IList<Permission>
property on a specific Object instance. The meaning of each of
the properties of Permission depend on what the permission is applied to, and so are
left undocumented here. See RealmPrivileges, ClassPrivileges, and
ObjectPrivileges for details about what each of the properties mean when applied to
that type.
Properties
| Improve this Doc View SourceCanCreate
Gets or sets a value indicating whether the user can create new objects of the type this Permission is attached to.
Declaration
[MapTo("canCreate")]
public bool CanCreate { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
This field is only applicable to Permissions attached to Classes, and not to Realms or Objects.
CanDelete
Gets or sets a value indicating whether the user can delete the object to which this Permission is attached.
Declaration
[MapTo("canDelete")]
public bool CanDelete { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
This field is only applicable to Permissions attached to Objects, and not to Realms or Classes.
CanModifySchema
Gets or sets a value indicating whether the user can modify the schema of the Realm which this Permission is attached to.
Declaration
[MapTo("canModifySchema")]
public bool CanModifySchema { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
This field is only applicable to Permissions attached to Realms, and not to Realms or Objects.
CanQuery
Gets or sets a value indicating whether the user can subscribe to queries for this object type.
Declaration
[MapTo("canQuery")]
public bool CanQuery { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
This field is only applicable to Permissions attached to Classes, and not to Realms or Objects.
CanRead
Gets or sets a value indicating whether the user can read the object to which this Permission is attached.
Declaration
[MapTo("canRead")]
public bool CanRead { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
CanSetPermissions
Gets or sets a value indicating whether the user can add or modify Permissions for the object which this Permission is attached to.
Declaration
[MapTo("canSetPermissions")]
public bool CanSetPermissions { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
CanUpdate
Gets or sets a value indicating whether the user can modify the object to which this Permission is attached.
Declaration
[MapTo("canUpdate")]
public bool CanUpdate { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Role
Gets 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.
Declaration
[MapTo("role")]
public PermissionRole Role { get; }
Property Value
Type | Description |
---|---|
PermissionRole |
Methods
| Improve this Doc View SourceGet(PermissionRole, Realm)
Gets or creates a Permission instance for the named role on the Realm.
Declaration
public static Permission Get(PermissionRole role, Realm realm)
Parameters
Type | Name | Description |
---|---|---|
PermissionRole | role | The PermissionRole associated with that Permission. |
Realm | realm | The Realm whose permissions this Permission instance manipulates. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the Realm permissions of that PermissionRole. |
Remarks
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.
Get(PermissionRole, RealmObject)
Gets or creates a Permission instance for the named role on the object.
Declaration
public static Permission Get(PermissionRole role, RealmObject obj)
Parameters
Type | Name | Description |
---|---|---|
PermissionRole | role | The PermissionRole associated with that Permission. |
RealmObject | obj | The RealmObject inheritor whose permissions this Permission instance manipulates. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the object permissions of that PermissionRole. |
Remarks
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 object, merging duplicates or creating and adding new ones as needed.
The given object must have a IList<Permission>
property defined on it.
If more than one such property exists, the first one will be used.
Get(PermissionRole, IList<Permission>)
Gets or creates a Permission instance for the named role on the collection.
Declaration
public static Permission Get(PermissionRole role, IList<Permission> permissions)
Parameters
Type | Name | Description |
---|---|---|
PermissionRole | role | The PermissionRole associated with that Permission. |
IList<Permission> | permissions | The collection of permissions to which the new instance will be added. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the object permissions of that PermissionRole. |
Remarks
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 object, merging duplicates or creating and adding new ones as needed.
Get(PermissionRole, String, Realm)
Gets or creates a Permission instance for the named role on the class.
Declaration
public static Permission Get(PermissionRole role, string className, Realm realm)
Parameters
Type | Name | Description |
---|---|---|
PermissionRole | role | The PermissionRole associated with that Permission. |
String | className | The name of the RealmObject subclass whose corresponding class permissions this Permission instance manipulates. |
Realm | realm | The Realm whose class permissions this Permission instance manipulates. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the class permissions of that PermissionRole. |
Remarks
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.
Get(String, Realm)
Gets or creates a Permission instance for the named role on the Realm.
Declaration
public static Permission Get(string roleName, Realm realm)
Parameters
Type | Name | Description |
---|---|---|
String | roleName | The name of the PermissionRole associated with that Permission. If no such Role exists, it will be created automatically. |
Realm | realm | The Realm whose permissions this Permission instance manipulates. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the Realm permissions of that PermissionRole. |
Remarks
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.
Get(String, RealmObject)
Gets or creates a Permission instance for the named role on the object.
Declaration
public static Permission Get(string roleName, RealmObject obj)
Parameters
Type | Name | Description |
---|---|---|
String | roleName | The name of the PermissionRole associated with that Permission. If no such Role exists, it will be created automatically. |
RealmObject | obj | The RealmObject inheritor whose permissions this Permission instance manipulates. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the object permissions of that PermissionRole. |
Remarks
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 object, merging duplicates or creating and adding new ones as needed.
The given object must have a IList<Permission>
property defined on it.
If more than one such property exists, the first one will be used.
Get(String, IList<Permission>)
Gets or creates a Permission instance for the named role on the collection.
Declaration
public static Permission Get(string roleName, IList<Permission> permissions)
Parameters
Type | Name | Description |
---|---|---|
String | roleName | The name of the PermissionRole associated with that Permission. If no such Role exists, it will be created automatically. |
IList<Permission> | permissions | The collection of permissions to which the new instance will be added. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the object permissions of that PermissionRole. |
Remarks
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 object, merging duplicates or creating and adding new ones as needed.
Get(String, String, Realm)
Gets or creates a Permission instance for the named role on the class.
Declaration
public static Permission Get(string roleName, string className, Realm realm)
Parameters
Type | Name | Description |
---|---|---|
String | roleName | The name of the PermissionRole associated with that Permission. If no such Role exists, it will be created automatically. |
String | className | The name of the RealmObject subclass whose corresponding class permissions this Permission instance manipulates. |
Realm | realm | The Realm whose class permissions this Permission instance manipulates. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the class permissions of that PermissionRole. |
Remarks
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.
Get<T>(PermissionRole, Realm)
Gets or creates a Permission instance for the named role on the class.
Declaration
public static Permission Get<T>(PermissionRole role, Realm realm)
where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
PermissionRole | role | The PermissionRole associated with that Permission. |
Realm | realm | The Realm whose class permissions this Permission instance manipulates. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the class permissions of that PermissionRole. |
Type Parameters
Name | Description |
---|---|
T | The RealmObject subclass whose corresponding class permissions this Permission instance manipulates. |
Remarks
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.
Get<T>(String, Realm)
Gets or creates a Permission instance for the named role on the class.
Declaration
public static Permission Get<T>(string roleName, Realm realm)
where T : RealmObject
Parameters
Type | Name | Description |
---|---|---|
String | roleName | The name of the PermissionRole associated with that Permission. If no such Role exists, it will be created automatically. |
Realm | realm | The Realm whose class permissions this Permission instance manipulates. |
Returns
Type | Description |
---|---|
Permission | A Permission instance that can be used to inspect or modify the class permissions of that PermissionRole. |
Type Parameters
Name | Description |
---|---|
T | The RealmObject subclass whose corresponding class permissions this Permission instance manipulates. |
Remarks
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.