public class Role extends RealmObject
Constructor and Description |
---|
Role() |
Role(String name)
Creates a new named role.
|
Modifier and Type | Method and Description |
---|---|
void |
addMember(String userId)
Adds a member to this Role.
|
RealmList<PermissionUser> |
getMembers()
Returns the list of
PermissionUser within this role. |
String |
getName()
Returns the name of this role.
|
boolean |
hasMember(String userId)
Checks if the provided user has this role.
|
boolean |
removeMember(String userId)
Removes a member from this Role.
|
addChangeListener, addChangeListener, addChangeListener, addChangeListener, asChangesetObservable, asChangesetObservable, asFlowable, asFlowable, deleteFromRealm, deleteFromRealm, getRealm, getRealm, isLoaded, isLoaded, isManaged, isManaged, isValid, isValid, load, load, removeAllChangeListeners, removeAllChangeListeners, removeChangeListener, removeChangeListener, removeChangeListener, removeChangeListener
public Role()
public Role(String name)
name
- a unique name for the role.public String getName()
public void addMember(String userId)
userId
- userid of the SyncUser.IllegalStateException
- if not in a write transaction.IllegalArgumentException
- if null
or empty userId
is provided.public boolean removeMember(String userId)
userId
- userid of the SyncUser to remove.true
if the user could be removed, false
if not.IllegalStateException
- if not in a write transaction.public boolean hasMember(String userId)
userId
- user to checktrue
if the user has this role, false
if not.public RealmList<PermissionUser> getMembers()
PermissionUser
within this role.