public final class PermissionOffer extends Object
offerToken that can be sent
to other users. Once they accept this token, the permissions covered by this offer will take effect for that
user.
Permission offers can only be created by users that can manage the Realm, the offer is about.
SyncUser.makePermissionsOfferAsync(PermissionOffer, SyncUser.Callback),
SyncUser.acceptPermissionsOfferAsync(String, SyncUser.Callback),
Permissions description for general
documentation.| Constructor and Description |
|---|
PermissionOffer(String url,
AccessLevel accessLevel)
Creates a request for an permission offer that last until it is manually revoked.
|
PermissionOffer(String url,
AccessLevel accessLevel,
Date expiresAt)
Creates a request for a permission offer that last until it is manually revoked.
|
PermissionOffer(String path,
AccessLevel accessLevel,
Date expiresAt,
Date createdAt,
String userId,
String token) |
| Modifier and Type | Method and Description |
|---|---|
AccessLevel |
getAccessLevel()
Returns the access level granted by this offer.
|
Date |
getCreatedAt()
Returns the timestamp when this offer was created.
|
Date |
getExpiresAt()
Returns when this offer expires.
|
String |
getRealmUrl()
Returns the Realm URL for which the permissions are granted.
|
String |
getToken()
Returns the offer token if this offer was successfully created.
|
boolean |
isOfferCreated()
Checks if the offer was successfully handled by the Realm Object Server.
|
boolean |
mayManage()
Returns whether or not the user accepting this offer is granted manage permission.
|
boolean |
mayRead()
Returns whether or not the user accepting this offer is granted read permission.
|
boolean |
mayWrite()
Returns whether or not the user accepting this offer is granted write permission.
|
String |
toString() |
public PermissionOffer(String url, AccessLevel accessLevel)
url - specific url to Realm effected this offer encompasses all Realms manged by the user making the offer.accessLevel - the AccessLevel granted to the user accepting the offer.SyncUser.invalidatePermissionsOfferAsync(String, SyncUser.Callback)public PermissionOffer(String url, AccessLevel accessLevel, Date expiresAt)
url - specific url to Realm effected. The user sending the offer must have manage rights to this Realm.accessLevel - the AccessLevel granted to the user accepting the offer.expiresAt - the date and time when this offer expires. If null is provided the offer never expires.SyncUser.invalidatePermissionsOfferAsync(String, SyncUser.Callback)public Date getCreatedAt()
public String getToken()
null if the offer wasn't created yet.public String getRealmUrl()
public boolean mayRead()
true if the user accepting this offer is granted read permission, false if not.public boolean mayWrite()
true if the user accepting this offer is granted write permission, false if not.public boolean mayManage()
true if the user accepting this offer is granted mange permission, false if not.public AccessLevel getAccessLevel()
public boolean isOfferCreated()
true if the request has been created, false if not.public Date getExpiresAt()
null is returned if this offer never expires.null if it never expires.