-
-
Notifications
You must be signed in to change notification settings - Fork 595
/
Copy pathParseACL.d.ts
137 lines (137 loc) · 5.33 KB
/
ParseACL.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import type ParseRole from './ParseRole';
import type ParseUser from './ParseUser';
type PermissionsMap = Record<string, boolean>;
type ByIdMap = Record<string, PermissionsMap>;
/**
* Creates a new ACL.
* If no argument is given, the ACL has no permissions for anyone.
* If the argument is a Parse.User, the ACL will have read and write
* permission for only that user.
* If the argument is any other JSON object, that object will be interpretted
* as a serialized ACL created with toJSON().
*
* <p>An ACL, or Access Control List can be added to any
* <code>Parse.Object</code> to restrict access to only a subset of users
* of your application.</p>
*
* @alias Parse.ACL
*/
declare class ParseACL {
permissionsById: ByIdMap;
/**
* @param {(Parse.User | object | null)} arg1 The user to initialize the ACL for
*/
constructor(arg1?: ParseUser | ByIdMap | null);
/**
* Returns a JSON-encoded version of the ACL.
*
* @returns {object}
*/
toJSON(): ByIdMap;
/**
* Returns whether this ACL is equal to another object
*
* @param {ParseACL} other The other object's ACL to compare to
* @returns {boolean}
*/
equals(other: ParseACL): boolean;
_setAccess(accessType: string, userId: ParseUser | ParseRole | string, allowed: boolean): void;
_getAccess(accessType: string, userId: ParseUser | ParseRole | string): boolean;
/**
* Sets whether the given user is allowed to read this object.
*
* @param userId An instance of Parse.User or its objectId.
* @param {boolean} allowed Whether that user should have read access.
*/
setReadAccess(userId: ParseUser | ParseRole | string, allowed: boolean): void;
/**
* Get whether the given user id is *explicitly* allowed to read this object.
* Even if this returns false, the user may still be able to access it if
* getPublicReadAccess returns true or a role that the user belongs to has
* write access.
*
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
* @returns {boolean}
*/
getReadAccess(userId: ParseUser | ParseRole | string): boolean;
/**
* Sets whether the given user id is allowed to write this object.
*
* @param userId An instance of Parse.User or its objectId, or a Parse.Role..
* @param {boolean} allowed Whether that user should have write access.
*/
setWriteAccess(userId: ParseUser | ParseRole | string, allowed: boolean): void;
/**
* Gets whether the given user id is *explicitly* allowed to write this object.
* Even if this returns false, the user may still be able to write it if
* getPublicWriteAccess returns true or a role that the user belongs to has
* write access.
*
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
* @returns {boolean}
*/
getWriteAccess(userId: ParseUser | ParseRole | string): boolean;
/**
* Sets whether the public is allowed to read this object.
*
* @param {boolean} allowed
*/
setPublicReadAccess(allowed: boolean): void;
/**
* Gets whether the public is allowed to read this object.
*
* @returns {boolean}
*/
getPublicReadAccess(): boolean;
/**
* Sets whether the public is allowed to write this object.
*
* @param {boolean} allowed
*/
setPublicWriteAccess(allowed: boolean): void;
/**
* Gets whether the public is allowed to write this object.
*
* @returns {boolean}
*/
getPublicWriteAccess(): boolean;
/**
* Gets whether users belonging to the given role are allowed
* to read this object. Even if this returns false, the role may
* still be able to write it if a parent role has read access.
*
* @param role The name of the role, or a Parse.Role object.
* @returns {boolean} true if the role has read access. false otherwise.
* @throws {TypeError} If role is neither a Parse.Role nor a String.
*/
getRoleReadAccess(role: ParseRole | string): boolean;
/**
* Gets whether users belonging to the given role are allowed
* to write this object. Even if this returns false, the role may
* still be able to write it if a parent role has write access.
*
* @param role The name of the role, or a Parse.Role object.
* @returns {boolean} true if the role has write access. false otherwise.
* @throws {TypeError} If role is neither a Parse.Role nor a String.
*/
getRoleWriteAccess(role: ParseRole | string): boolean;
/**
* Sets whether users belonging to the given role are allowed
* to read this object.
*
* @param role The name of the role, or a Parse.Role object.
* @param {boolean} allowed Whether the given role can read this object.
* @throws {TypeError} If role is neither a Parse.Role nor a String.
*/
setRoleReadAccess(role: ParseRole | string, allowed: boolean): void;
/**
* Sets whether users belonging to the given role are allowed
* to write this object.
*
* @param role The name of the role, or a Parse.Role object.
* @param {boolean} allowed Whether the given role can write this object.
* @throws {TypeError} If role is neither a Parse.Role nor a String.
*/
setRoleWriteAccess(role: ParseRole | string, allowed: boolean): void;
}
export default ParseACL;