public 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.
Constructor and Description |
---|
PermissionOffer()
Constructor required by Realm.
|
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.
|
Modifier and Type | Method and Description |
---|---|
Date |
getCreatedAt()
Returns the timestamp when this offer was created.
|
Date |
getExpiresAt()
Returns when this offer expires.
|
String |
getId()
Returns the id uniquely identifying this offer.
|
String |
getRealmUrl()
Returns the Realm URL for which the permissions are granted.
|
Integer |
getStatusCode()
Returns the server status code for this change.
|
String |
getStatusMessage()
Returns the servers status message, if an error occurred.
|
String |
getToken()
Returns the offer token if this offer was successfully created.
|
Date |
getUpdatedAt()
Returns the timestamp this offer was last updated.
|
boolean |
isOfferCreated()
Checks if the request 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()
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.PermissionManager.revokeOffer(String, PermissionManager.RevokeOfferCallback)
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.PermissionManager.revokeOffer(String, PermissionManager.RevokeOfferCallback)
public String getId()
public Date getCreatedAt()
public Date getUpdatedAt()
public Integer getStatusCode()
null
if not yet processed. 0
if successful, >0
if an error happened.
See getStatusMessage()
.public String getStatusMessage()
null
.null
otherwise.public boolean isOfferCreated()
true
if the request was handled successfully. false
if not. See getStatusMessage()
for the full error message.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 Date getExpiresAt()
null
is returned if this offer never expires.null
if it never expires.