public class Permission extends RealmObject
Role
. These privileges can be
applied to either the entire Realm, Classes or individual objects.
If no privileges are defined for an individual object, the values ClassPermissions
will be inherited, if no values are defined there, the ones from RealmPermissions
will
be used. If no values can be found there, no privileges are granted.
Not all privileges are meaningful all levels, e.g. `canCreate` is only meaningful when applied to classes, but it can still be defined at the Realm level. In that case all class permission objects will inherit the value unless they specifically override it. See the individual privileges for the details.
When added to either RealmPermissions
, ClassPermissions
or a RealmObject
,
only one Permission object can exist for that role. If multiple objects are added the behavior
is undefined and the Object Server might modify or delete both objects.
Modifier and Type | Class and Description |
---|---|
static class |
Permission.Builder
Creates a
Permission object in a fluid manner. |
Constructor and Description |
---|
Permission() |
Permission(Role role)
Creates a set of privileges for the given role.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canCreate()
Returns
true if the role is allowed to create objects, false if not. |
boolean |
canDelete()
Returns
true if the role is allowed to delete the object , false if not. |
boolean |
canModifySchema()
Returns
true if the role is allowed to modify the schema of the resource,
false if not. |
boolean |
canQuery()
Returns
true if the role is allowed to query the resource, false if not. |
boolean |
canRead()
Returns
true if the role is allowed to read the resource, false if not. |
boolean |
canSetPermissions()
Returns
true if this this role is allowed to change permissions on the given resource. |
boolean |
canUpdate()
Returns
true if the role is allowed to update the resource, false if not. |
Role |
getRole()
Returns the role these privileges apply to.
|
void |
setCanCreate(boolean canCreate)
Defines if this role is allowed to create objects of this type.
|
void |
setCanDelete(boolean canDelete)
Defines if this role can delete the given resource or not.
|
void |
setCanModifySchema(boolean canModifySchema)
Defines if this role is allowed to modify the schema of this resource.
|
void |
setCanQuery(boolean canQuery)
Defines if this role is allowed to query the resource or not.
|
void |
setCanRead(boolean canRead)
Defines if this role can read from given resource or not.
|
void |
setCanSetPermissions(boolean canSetPermissions)
Defines if this role is allowed to change permissions on the given resource.
|
void |
setCanUpdate(boolean canUpdate)
Defines if this role can update the given resource or not.
|
addChangeListener, addChangeListener, addChangeListener, addChangeListener, asChangesetObservable, asChangesetObservable, asFlowable, asFlowable, deleteFromRealm, deleteFromRealm, freeze, freeze, getRealm, getRealm, isFrozen, isFrozen, isLoaded, isLoaded, isManaged, isManaged, isValid, isValid, load, load, removeAllChangeListeners, removeAllChangeListeners, removeChangeListener, removeChangeListener, removeChangeListener, removeChangeListener
public Permission()
public Permission(Role role)
public Role getRole()
public boolean canRead()
true
if the role is allowed to read the resource, false
if not.public void setCanRead(boolean canRead)
false
, the
Realm will appear completely empty to the role, effectively making it inaccessible.
false
.
If false
, the role cannot see any object of this type and all queries
against the type will return no results.
canRead
- true
if the role is allowed to read this resource, false
if not.public boolean canUpdate()
true
if the role is allowed to update the resource, false
if not.public void setCanUpdate(boolean canUpdate)
true
, the role is allowed update properties on all objects in the Realm.
This does not include updating permissions nor creating or deleting objects.
true
, the role is allowed update properties on all objects of this type in
the Realm. This does not include updating permissions nor creating or deleting objects.
true
, the role is allowed to update properties on the object. This
does not cover updating permissions or deleting the object.
canUpdate
- true
if the role is allowed to update this resource, false
if not.public boolean canDelete()
true
if the role is allowed to delete the object , false
if not.public void setCanDelete(boolean canDelete)
true
, the role is allowed to delete the object.
canDelete
- true
if the role is allowed to delete this resource, false
if not.public boolean canSetPermissions()
true
if this this role is allowed to change permissions on the given resource.public void setCanSetPermissions(boolean canSetPermissions)
RealmPermissions
object.
ClassPermissions
object.
canSetPermissions
- true
if the role is allowed to change the permissions for this resource.public boolean canQuery()
true
if the role is allowed to query the resource, false
if not.public void setCanQuery(boolean canQuery)
Note, that local queries are always possible, but the query result will just be empty.
canQuery
- true
if the role is allowed to query objects of this type.public boolean canCreate()
true
if the role is allowed to create objects, false
if not.public void setCanCreate(boolean canCreate)
true
, the role is allowed to create objects of this type.
canCreate
- true
if the role is allowed to create objects of this type.public boolean canModifySchema()
true
if the role is allowed to modify the schema of the resource,
false
if not.public void setCanModifySchema(boolean canModifySchema)
true
the role is allowed to create classes in the Realm.
true
, the role is allowed to add properties to the specified class.
canModifySchema
- true
if the role is allowed to modify the schema of this resource.