//////////////////////////////////////////////////////////////////////////// // // Copyright 2016 Realm Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////// #import #import #import #import NS_ASSUME_NONNULL_BEGIN /** This model is used for offering permission changes to other users. It should be used in conjunction with an `RLMSyncUser`'s Management Realm. See https://realm.io/docs/realm-object-server/#permissions for general documentation. */ @interface RLMSyncPermissionOffer : RLMObject /// The globally unique ID string of this permission offer object. @property (readonly) NSString *id; /// The date this object was initially created. @property (readonly) NSDate *createdAt; /// The date this object was last modified. @property (readonly) NSDate *updatedAt; /// The status code of the object that was processed by Realm Object Server. @property (nullable, readonly) NSNumber *statusCode; /// An error or informational message, typically written to by the Realm Object Server. @property (nullable, readonly) NSString *statusMessage; /// Sync management object status. @property (readonly) RLMSyncManagementObjectStatus status; /// A token which uniquely identifies this offer. Generated by the server. @property (nullable, readonly) NSString *token; /// The remote URL to the realm. @property (readonly) NSString *realmUrl; /// Whether this offer allows the receiver to read from the Realm. @property (readonly) BOOL mayRead; /// Whether this offer allows the receiver to write to the Realm. @property (readonly) BOOL mayWrite; /// Whether this offer allows the receiver to manage the access rights for others. @property (readonly) BOOL mayManage; /// When this token will expire and become invalid. @property (nullable, readonly) NSDate *expiresAt; /** Construct a permission offer object used to offer permission changes to other users. @param realmURL The URL to the Realm on which to apply these permission changes to, once the offer is accepted. @param expiresAt When this token will expire and become invalid. Pass `nil` if this offer should not expire. @param mayRead Grant or revoke read access. @param mayWrite Grant or revoked read-write access. @param mayManage Grant or revoke administrative access. */ + (instancetype)permissionOfferWithRealmURL:(NSString *)realmURL expiresAt:(nullable NSDate *)expiresAt read:(BOOL)mayRead write:(BOOL)mayWrite manage:(BOOL)mayManage; @end NS_ASSUME_NONNULL_END