RLMSyncPermissionChange.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 Realm Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. //
  17. ////////////////////////////////////////////////////////////////////////////
  18. #import <Foundation/Foundation.h>
  19. #import <Realm/RLMObject.h>
  20. #import <Realm/RLMProperty.h>
  21. #import <Realm/RLMSyncUtil.h>
  22. NS_ASSUME_NONNULL_BEGIN
  23. /**
  24. This model is used for requesting changes to a Realm's permissions.
  25. It should be used in conjunction with an `RLMSyncUser`'s Management Realm.
  26. See https://realm.io/docs/realm-object-server/#permissions for general
  27. documentation.
  28. */
  29. __deprecated_msg("Use `-[RLMSyncUser applyPermission:callback:]` and `-[RLMSyncUser revokePermission:callback:]`")
  30. @interface RLMSyncPermissionChange : RLMObject
  31. /// The globally unique ID string of this permission change object.
  32. @property (readonly) NSString *id;
  33. /// The date this object was initially created.
  34. @property (readonly) NSDate *createdAt;
  35. /// The date this object was last modified.
  36. @property (readonly) NSDate *updatedAt;
  37. /// The status code of the object that was processed by Realm Object Server.
  38. @property (nullable, readonly) NSNumber<RLMInt> *statusCode;
  39. /// An error or informational message, typically written to by the Realm Object Server.
  40. @property (nullable, readonly) NSString *statusMessage;
  41. /// Sync management object status.
  42. @property (readonly) RLMSyncManagementObjectStatus status;
  43. /// The remote URL to the realm.
  44. @property (readonly) NSString *realmUrl;
  45. /// The identity of a user affected by this permission change.
  46. @property (readonly) NSString *userId;
  47. /// Define read access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting.
  48. @property (nullable, readonly) NSNumber<RLMBool> *mayRead;
  49. /// Define write access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting.
  50. @property (nullable, readonly) NSNumber<RLMBool> *mayWrite;
  51. /// Define management access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting.
  52. @property (nullable, readonly) NSNumber<RLMBool> *mayManage;
  53. /**
  54. Construct a permission change object used to change the access permissions for a user on a Realm.
  55. @param realmURL The Realm URL whose permissions settings should be changed.
  56. Use `*` to change the permissions of all Realms managed by the Management Realm's `RLMSyncUser`.
  57. @param userID The user or users who should be granted these permission changes.
  58. Use `*` to change the permissions for all users.
  59. @param mayRead Define read access. Set to `YES` or `NO` to update this value.
  60. Leave unset to preserve the existing setting.
  61. @param mayWrite Define write access. Set to `YES` or `NO` to update this value.
  62. Leave unset to preserve the existing setting.
  63. @param mayManage Define management access. Set to `YES` or `NO` to update this value.
  64. Leave unset to preserve the existing setting.
  65. */
  66. + (instancetype)permissionChangeWithRealmURL:(NSString *)realmURL
  67. userID:(NSString *)userID
  68. read:(nullable NSNumber<RLMBool> *)mayRead
  69. write:(nullable NSNumber<RLMBool> *)mayWrite
  70. manage:(nullable NSNumber<RLMBool> *)mayManage;
  71. @end
  72. NS_ASSUME_NONNULL_END