public class ClassPermissions extends RealmObject
If a class level permission grants a privilege, it is still possible for individual objects to revoke them again, i.e. it is possible for the class level permission to grant general read access, while the individual objects are still able to revoke them.
The opposite is not true, so if a privilege is not granted at the class level, it can never be granted at the object level, no matter what kind of permissions are set there.
Constructor and Description |
---|
ClassPermissions() |
ClassPermissions(Class<? extends RealmModel> clazz)
Creates permissions for the given Realm model class.
|
Modifier and Type | Method and Description |
---|---|
Permission |
findOrCreate(String roleName)
Finds the permissions associated with a given
Role . |
String |
getName()
Returns the name of the class these permissions apply to.
|
RealmList<Permission> |
getPermissions()
Returns all Class level permissions for the class defined by
getName() . |
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 ClassPermissions()
public ClassPermissions(Class<? extends RealmModel> clazz)
ClassPermissions
object
can exist pr Realm model class.clazz
- class to create permissions.public String getName()
public RealmList<Permission> getPermissions()
getName()
. This is the
default set of permissions for the class unless otherwise re-defined by object level
permissions.public Permission findOrCreate(String roleName)
Role
. If either the role or the permission
object doesn't exists, it will be created.
If the Permission
object is created because one didn't exist already, it will be
created with all privileges disabled.
If the the Role
object is created because one didn't exists, it will be created
with no members.
roleName
- name of the role to find.IllegalStateException
- if this object is not managed by Realm.IllegalStateException
- if this method is not called inside a write transaction.IllegalArgumentException
- if a null
or empty