mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-04 10:43:29 +00:00
Fix typescript definitions for privileges() methods (#2030)
This commit is contained in:
parent
37d04c4df2
commit
79759dce29
@ -1,7 +1,9 @@
|
||||
X.Y.Z Release notes
|
||||
=============================================================
|
||||
|
||||
### Bug fixes
|
||||
* Fixed the type definition for `Realm.Permissions.User`. Thanks to @apperside! ([#2012](https://github.com/realm/realm-js/issues/2012), since v2.3.0-beta.2)
|
||||
* Fixed the type definition for `Realm.getPrivileges()`, `Realm.getPrivileges(className)` and `Realm.getPrivileges(object)`. ([#2030](https://github.com/realm/realm-js/pull/2030), since v2.2.14)
|
||||
|
||||
### Compatibility
|
||||
* Realm Object Server: 3.0.0 or later
|
||||
|
@ -153,7 +153,7 @@ class Realm {
|
||||
close() {}
|
||||
|
||||
/**
|
||||
* Returns the granted privilges.
|
||||
* Returns the granted privileges.
|
||||
*
|
||||
* This combines all privileges granted on the Realm/Class/Object by all Roles which
|
||||
* the current User is a member of into the final privileges which will
|
||||
@ -166,10 +166,11 @@ class Realm {
|
||||
*
|
||||
* Non-synchronized Realms always have permission to perform all operations.
|
||||
*
|
||||
* @param {(Realm~ObjectType|Realm.Object)} arg - the object type or the object to compute priviliges from
|
||||
* @returns {Object} as the computed priviliges as properties
|
||||
* @param {(Realm~ObjectType|Realm.Object)} arg - the object type or the object to compute privileges from. If no
|
||||
* argument is given, the privileges for the Realm is returned.
|
||||
* @returns {Object} as the computed privileges as properties
|
||||
* @since 2.3.0
|
||||
* @see {Realm.Permissions} for details of priviliges and roles.
|
||||
* @see {Realm.Permissions} for details of privileges and roles.
|
||||
*/
|
||||
privileges(arg) {}
|
||||
|
||||
|
33
lib/index.d.ts
vendored
33
lib/index.d.ts
vendored
@ -580,13 +580,13 @@ declare namespace Realm.Permissions {
|
||||
static schema: ObjectSchema;
|
||||
|
||||
identity: string;
|
||||
canCreate: boolean;
|
||||
canRead: boolean;
|
||||
canUpdate: boolean;
|
||||
canDelete: boolean;
|
||||
canSetPermissions: boolean;
|
||||
canQuery: boolean;
|
||||
canCreate: boolean;
|
||||
canModifySchema: boolean;
|
||||
canSetPermissions: boolean;
|
||||
}
|
||||
|
||||
class User {
|
||||
@ -610,6 +610,29 @@ declare namespace Realm.Permissions {
|
||||
static schema: ObjectSchema;
|
||||
permissions: Permission[];
|
||||
}
|
||||
|
||||
class RealmPrivileges {
|
||||
canRead: boolean;
|
||||
canUpdate: boolean;
|
||||
canModifySchema: boolean;
|
||||
canSetPermissions: boolean;
|
||||
}
|
||||
|
||||
class ClassPrivileges {
|
||||
canCreate: boolean
|
||||
canRead: boolean;
|
||||
canUpdate: boolean;
|
||||
canQuery: boolean;
|
||||
canModifySchema: boolean;
|
||||
canSetPermissions: boolean;
|
||||
}
|
||||
|
||||
class ObjectPrivileges {
|
||||
canRead: boolean;
|
||||
canUpdate: boolean;
|
||||
canDelete: boolean;
|
||||
canSetPermissions: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface ProgressPromise extends Promise<Realm> {
|
||||
@ -778,9 +801,9 @@ declare class Realm {
|
||||
*/
|
||||
writeCopyTo(path: string, encryptionKey?: ArrayBuffer | ArrayBufferView): void;
|
||||
|
||||
privileges() : Realm.Permissions.Realm;
|
||||
privileges(objectType: string | Realm.ObjectSchema | Function) : Realm.Permissions.Class;
|
||||
privileges(obj: Realm.Object) : Realm.Permissions.Class;
|
||||
privileges() : Realm.Permissions.RealmPrivileges;
|
||||
privileges(objectType: string | Realm.ObjectSchema | Function) : Realm.Permissions.ClassPrivileges;
|
||||
privileges(obj: Realm.Object) : Realm.Permissions.ObjectPrivileges;
|
||||
}
|
||||
|
||||
declare module 'realm' {
|
||||
|
Loading…
x
Reference in New Issue
Block a user