public enum AccessLevel extends Enum<AccessLevel>
PermissionRequest
.
Note that each access level guarantees all allowed actions provided by less permissive access levels.
Specifically, users with write access to a Realm can always read from that Realm, and users with administrative
access can always read or write from the Realm. This means that NONE < READ < WRITE < ADMIN
.
Enum Constant and Description |
---|
ADMIN
User can read, write, and administer the Realm.
|
NONE
The user does not have access to this Realm.
|
READ
User can only read the contents of the Realm.
|
WRITE
User can read and write the contents of the Realm.
|
Modifier and Type | Method and Description |
---|---|
static AccessLevel |
fromKey(String accessLevel) |
String |
getKey() |
boolean |
mayManage()
Returns
true if the user is allowed to manage the Realm, false if not. |
boolean |
mayRead()
Returns
true if the user is allowed to read a Realm, false if not. |
boolean |
mayWrite()
Returns
true if the user is allowed to write to the Realm, false if not. |
static AccessLevel |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static AccessLevel[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final AccessLevel NONE
public static final AccessLevel READ
Users who have read-only access to a Realm should open it using `readOnly()` and
`waitForInitialRemoteData()` on the SyncConfiguration
. Attempting to directly open the Realm
is an error; in this case the Realm must manually be deleted using Realm.deleteRealm(RealmConfiguration)
before being re-opened with the correct configuration.
SyncConfiguration config = new SyncConfiguration(getUser(), getUrl())
.readOnly()
.waitForInitialRemoteData()
.build();
public static final AccessLevel WRITE
public static final AccessLevel ADMIN
public static AccessLevel[] values()
for (AccessLevel c : AccessLevel.values()) System.out.println(c);
public static AccessLevel valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static AccessLevel fromKey(String accessLevel)
public boolean mayRead()
true
if the user is allowed to read a Realm, false
if not.public boolean mayWrite()
true
if the user is allowed to write to the Realm, false
if not.public boolean mayManage()
true
if the user is allowed to manage the Realm, false
if not.
Having this permission, means the user is able to grant permissions to other users as well as remove them again.
public String getKey()