-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align permission API's with Java/Swift #2036
Conversation
# Conflicts: # lib/index.d.ts # lib/user-methods.js
Ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly changelog and documentation comments.
👍
docs/permission.js
Outdated
* If the Permission object is created because one didn't exist already, it will be | ||
* created with all privileges disabled. | ||
* | ||
* If the Role object is created because one didn't exists, it will be created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"exists" -> "exist"
docs/permission.js
Outdated
|
||
/** | ||
* Finds the Class-level permissions associated with the named Role. If either the role or the permission | ||
* object doesn't exists, it will be created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"exists" -> "exist"
docs/permission.js
Outdated
|
||
/** | ||
* Finds the Realm-level permissions associated with the named Role. If either the role or the permission | ||
* object doesn't exists, it will be created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"exists" -> "exist"
CHANGELOG.md
Outdated
@@ -1,8 +1,13 @@ | |||
x.x.x Release notes (yyyy-MM-dd) | |||
============================================================= | |||
## Enhancements | |||
* None | |||
|
|||
* Added support for finding Realm-level permissions in Query-based Realms using `realm.getPermissions()` ([#2036] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move .
to end of sentence: "Added ... using realm.getPermissions()
. ([..."
docs/realm.js
Outdated
/** | ||
* Returns the fine-grained permissions object associated with either the Realm itself or a Realm model class. | ||
* | ||
* @param {Realm~ObjectType} [arg] - If no argument is provided, the Realm-level permissions are are returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"are are" -> "are"
lib/extensions.js
Outdated
} | ||
|
||
// Realm instance methods that are available always available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove one "available"
Changelog is fine. |
This PR aligns the JS API with Java/Swift by introducing a number of helper methods.
It adds
TODO:
permissions()
method + testfindOrCreate(roleName)
+ testsIn order for Realm to pick up extra methods on model classes we have to register the Javascript constructor function with Realm. This, unfortunately, means I have to revert the change by Nabil and move it back to JS land, but it is done in a way compatible with the C++ implementation so that
new Realm(config)
will also include the schema. This is done by adding the internal_constructor
method as wrapping the original constructor itself seemed to cause other places in our code base (and possible client code as well).