Class PermissionOffer
Objects of this class are used to offer permissions to owned Realms. They are created exclusively by the client and are processed by the server as indicated by the status fields.
Inherited Members
Namespace: Realms.Sync
Assembly: Realm.Sync.dll
Syntax
public class PermissionOffer : RealmObject, INotifyPropertyChanged, ISchemaSource, IThreadConfined, NotificationsHelper.INotifiable, IPermissionObject, IStatusObject
Remarks
When offering permissions, you should create the offer and add it to the User's Management Realm. Then you should subscribe to PropertyChanged to be notified when the server has processed the request. Once the request has been processed, the Status, StatusMessage, and ErrorCode will be updated accordingly. If the request has been processed successfully, the Token will be populated and you can share it with users you wish to grant permissions to. If the request has failed, the StatusMessage will be updated with relevant information about the failure and ErrorCode will be set to a non-null value.
Properties
| Improve this Doc View SourceCreatedAt
Gets the creation time of this object.
Declaration
[MapTo("createdAt")]
public DateTimeOffset CreatedAt { get; }
Property Value
Type | Description |
---|---|
DateTimeOffset | A DateTimeOffset indicating the object's creation date and time. |
Implements
| Improve this Doc View SourceErrorCode
Gets the ErrorCode if any.
Declaration
public ErrorCode? ErrorCode { get; }
Property Value
Type | Description |
---|---|
Nullable<ErrorCode> | An ErrorCode that indicates the reason for the error during processing.
|
Implements
Remarks
Filled by the server after an object was processed indicating the status of the operation. If Status returns Error, the ErrorCode property can be used to get a strongly typed code for the error and handle expected error conditions, such as expired offer or attempting to share a realm without having manage access.
ExpiresAt
Gets the expiration date and time of the offer.
Declaration
[MapTo("expiresAt")]
public DateTimeOffset? ExpiresAt { get; }
Property Value
Type | Description |
---|---|
Nullable<DateTimeOffset> | If |
Id
Gets the unique identifier of this object in the Management realm.
Declaration
[PrimaryKey]
[Required]
[MapTo("id")]
public string Id { get; }
Property Value
Type | Description |
---|---|
String | The unique id of the object. |
Implements
| Improve this Doc View SourceMayManage
Gets a value indicating whether the receiver of this offer will be able to manage access rights for others.
Declaration
[MapTo("mayManage")]
public bool MayManage { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
MayRead
Gets a value indicating whether the receiver of this offer will be able to read from the Realm.
Declaration
[MapTo("mayRead")]
public bool MayRead { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
MayWrite
Gets a value indicating whether the receiver of this offer will be able to write to the Realm.
Declaration
[MapTo("mayWrite")]
public bool MayWrite { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
RealmUrl
Gets the url of the Realm to offer permissions to.
Declaration
[MapTo("realmUrl")]
[Required]
public string RealmUrl { get; }
Property Value
Type | Description |
---|---|
String |
Status
Gets the ManagementObjectStatus as set by the server.
Declaration
public ManagementObjectStatus Status { get; }
Property Value
Type | Description |
---|---|
ManagementObjectStatus | An enum indicating whether the operation has completed successfully. |
Implements
| Improve this Doc View SourceStatusCode
Declaration
[MapTo("statusCode")]
public int ? StatusCode { get; set; }
Property Value
Type | Description |
---|---|
Nullable<Int32> |
StatusMessage
Gets the status message.
Declaration
[MapTo("statusMessage")]
public string StatusMessage { get; }
Property Value
Type | Description |
---|---|
String | A detailed message describing the status (success, error) of the operation. |
Implements
Remarks
Filled by the server after an object was processed with additional info explaining the status if necessary.
Token
Gets the token that can be used to offer the permissions defined in this object to another user.
Declaration
[MapTo("token")]
[Indexed]
public string Token { get; }
Property Value
Type | Description |
---|---|
String | A string, set by the server, that can be used to create a PermissionOfferResponse. |
UpdatedAt
Gets when the object was updated the last time.
Declaration
[MapTo("updatedAt")]
public DateTimeOffset UpdatedAt { get; }
Property Value
Type | Description |
---|---|
DateTimeOffset | A DateTimeOffset indicating the last time the object has been updated. |
Implements
Remarks
This will be updated by the server with the current object when the object is processed.
Methods
| Improve this Doc View SourceOnPropertyChanged(String)
Called when a property has changed on this class.
Declaration
protected override void OnPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | The name of the property. |
Overrides
Remarks
For this method to be called, you need to have first subscribed to PropertyChanged. This can be used to react to changes to the current object, e.g. raising PropertyChanged for computed properties.