parse 4.0.0-alpha.1 → 4.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +167 -25
- package/NOTICE +10 -0
- package/README.md +6 -5
- package/dist/parse.js +12838 -21190
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +7921 -17062
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +2 -27
- package/lib/browser/AnonymousUtils.js +6 -42
- package/lib/browser/Cloud.js +12 -77
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -191
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -8
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -42
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -20
- package/lib/browser/LiveQueryClient.js +105 -213
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -19
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +61 -222
- package/lib/browser/Parse.js +12 -115
- package/lib/browser/ParseACL.js +33 -148
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -95
- package/lib/browser/ParseError.js +63 -99
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -89
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +665 -1845
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -70
- package/lib/browser/ParseQuery.js +403 -1504
- package/lib/browser/ParseRelation.js +12 -68
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -208
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -50
- package/lib/browser/RESTController.js +28 -157
- package/lib/browser/SingleInstanceStateController.js +19 -144
- package/lib/browser/Socket.weapp.js +0 -10
- package/lib/browser/Storage.js +10 -80
- package/lib/browser/StorageController.browser.js +4 -24
- package/lib/browser/StorageController.default.js +4 -24
- package/lib/browser/StorageController.react-native.js +6 -40
- package/lib/browser/StorageController.weapp.js +5 -23
- package/lib/browser/TaskQueue.js +1 -29
- package/lib/browser/UniqueInstanceStateController.js +19 -149
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -23
- package/lib/browser/canBeSerialized.js +3 -40
- package/lib/browser/decode.js +3 -40
- package/lib/browser/encode.js +9 -77
- package/lib/browser/equals.js +2 -34
- package/lib/browser/escape.js +1 -15
- package/lib/browser/isRevocableSession.js +2 -18
- package/lib/browser/parseDate.js +2 -20
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -24
- package/lib/browser/unsavedChildren.js +6 -57
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -25
- package/lib/node/AnonymousUtils.js +5 -44
- package/lib/node/Cloud.js +10 -73
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -227
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -8
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -44
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -22
- package/lib/node/LiveQueryClient.js +72 -154
- package/lib/node/LiveQuerySubscription.js +7 -26
- package/lib/node/LocalDatastore.js +19 -182
- package/lib/node/LocalDatastoreController.js +6 -45
- package/lib/node/LocalDatastoreController.react-native.js +6 -52
- package/lib/node/LocalDatastoreUtils.js +1 -13
- package/lib/node/ObjectStateMutations.js +13 -100
- package/lib/node/OfflineQuery.js +27 -151
- package/lib/node/Parse.js +11 -108
- package/lib/node/ParseACL.js +32 -157
- package/lib/node/ParseCLP.js +69 -269
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +49 -212
- package/lib/node/ParseGeoPoint.js +21 -89
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -17
- package/lib/node/ParseLiveQuery.js +10 -43
- package/lib/node/ParseObject.js +229 -964
- package/lib/node/ParseOp.js +31 -262
- package/lib/node/ParsePolygon.js +12 -69
- package/lib/node/ParseQuery.js +169 -888
- package/lib/node/ParseRelation.js +11 -68
- package/lib/node/ParseRole.js +10 -64
- package/lib/node/ParseSchema.js +46 -229
- package/lib/node/ParseSession.js +8 -57
- package/lib/node/ParseUser.js +107 -583
- package/lib/node/Push.js +4 -44
- package/lib/node/RESTController.js +18 -127
- package/lib/node/SingleInstanceStateController.js +17 -137
- package/lib/node/Socket.weapp.js +0 -7
- package/lib/node/Storage.js +10 -90
- package/lib/node/StorageController.browser.js +4 -30
- package/lib/node/StorageController.default.js +5 -28
- package/lib/node/StorageController.react-native.js +6 -47
- package/lib/node/StorageController.weapp.js +6 -28
- package/lib/node/TaskQueue.js +1 -24
- package/lib/node/UniqueInstanceStateController.js +16 -140
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -19
- package/lib/node/canBeSerialized.js +2 -35
- package/lib/node/decode.js +1 -33
- package/lib/node/encode.js +3 -61
- package/lib/node/equals.js +0 -27
- package/lib/node/escape.js +1 -13
- package/lib/node/isRevocableSession.js +1 -12
- package/lib/node/parseDate.js +1 -14
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -18
- package/lib/node/unsavedChildren.js +2 -45
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +2 -6
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +156 -711
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +46 -157
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +281 -948
- package/lib/react-native/LocalDatastoreController.js +71 -552
- package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +2 -65
- package/lib/react-native/OfflineQuery.js +25 -196
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +23 -161
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +55 -529
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +55 -472
- package/lib/react-native/ParseObject.js +245 -1246
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +182 -874
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +3 -54
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +95 -773
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +12 -109
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +0 -10
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -27
- package/lib/weapp/AnonymousUtils.js +6 -42
- package/lib/weapp/Cloud.js +12 -77
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -191
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -8
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -42
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -20
- package/lib/weapp/LiveQueryClient.js +105 -213
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -19
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +61 -222
- package/lib/weapp/Parse.js +12 -115
- package/lib/weapp/ParseACL.js +33 -148
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -95
- package/lib/weapp/ParseError.js +63 -99
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -89
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +665 -1845
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -70
- package/lib/weapp/ParseQuery.js +403 -1504
- package/lib/weapp/ParseRelation.js +12 -68
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -208
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -50
- package/lib/weapp/RESTController.js +28 -157
- package/lib/weapp/SingleInstanceStateController.js +19 -144
- package/lib/weapp/Socket.weapp.js +0 -10
- package/lib/weapp/Storage.js +10 -80
- package/lib/weapp/StorageController.browser.js +4 -24
- package/lib/weapp/StorageController.default.js +4 -24
- package/lib/weapp/StorageController.react-native.js +6 -40
- package/lib/weapp/StorageController.weapp.js +5 -23
- package/lib/weapp/TaskQueue.js +1 -29
- package/lib/weapp/UniqueInstanceStateController.js +19 -149
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -23
- package/lib/weapp/canBeSerialized.js +3 -40
- package/lib/weapp/decode.js +3 -40
- package/lib/weapp/encode.js +9 -77
- package/lib/weapp/equals.js +2 -34
- package/lib/weapp/escape.js +1 -15
- package/lib/weapp/isRevocableSession.js +2 -18
- package/lib/weapp/parseDate.js +2 -20
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -24
- package/lib/weapp/unsavedChildren.js +6 -57
- package/lib/weapp/uuid.js +1 -6
- package/package.json +35 -31
- package/PATENTS +0 -37
package/lib/node/ParseCLP.js
CHANGED
|
@@ -4,32 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _ParseRole = _interopRequireDefault(require("./ParseRole"));
|
|
9
|
-
|
|
10
8
|
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) {
|
|
13
10
|
return obj && obj.__esModule ? obj : {
|
|
14
11
|
default: obj
|
|
15
12
|
};
|
|
16
13
|
}
|
|
17
14
|
/**
|
|
18
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
19
|
-
* All rights reserved.
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the BSD-style license found in the
|
|
22
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
23
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
24
|
-
*
|
|
25
15
|
* @flow
|
|
26
16
|
*/
|
|
27
17
|
|
|
28
|
-
|
|
29
18
|
const PUBLIC_KEY = '*';
|
|
30
|
-
const VALID_PERMISSIONS
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
const VALID_PERMISSIONS /*: Map<string, UsersMap>*/ = new Map(
|
|
20
|
+
/*:: <string, UsersMap>*/
|
|
21
|
+
);
|
|
33
22
|
VALID_PERMISSIONS.set('get', {});
|
|
34
23
|
VALID_PERMISSIONS.set('find', {});
|
|
35
24
|
VALID_PERMISSIONS.set('count', {});
|
|
@@ -37,10 +26,11 @@ VALID_PERMISSIONS.set('create', {});
|
|
|
37
26
|
VALID_PERMISSIONS.set('update', {});
|
|
38
27
|
VALID_PERMISSIONS.set('delete', {});
|
|
39
28
|
VALID_PERMISSIONS.set('addField', {});
|
|
40
|
-
const VALID_PERMISSIONS_EXTENDED
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
const VALID_PERMISSIONS_EXTENDED /*: Map<string, UsersMap>*/ = new Map(
|
|
30
|
+
/*:: <string, UsersMap>*/
|
|
31
|
+
);
|
|
43
32
|
VALID_PERMISSIONS_EXTENDED.set('protectedFields', {});
|
|
33
|
+
|
|
44
34
|
/**
|
|
45
35
|
* Creates a new CLP.
|
|
46
36
|
* If no argument is given, the CLP has no permissions for anyone.
|
|
@@ -133,68 +123,52 @@ VALID_PERMISSIONS_EXTENDED.set('protectedFields', {});
|
|
|
133
123
|
*
|
|
134
124
|
* @alias Parse.CLP
|
|
135
125
|
*/
|
|
136
|
-
|
|
137
126
|
class ParseCLP {
|
|
138
127
|
/*:: permissionsMap: PermissionsMap;*/
|
|
139
|
-
|
|
140
128
|
/**
|
|
141
129
|
* @param {(Parse.User | Parse.Role | object)} userId The user to initialize the CLP for
|
|
142
130
|
*/
|
|
143
|
-
constructor(userId
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.permissionsMap = {}; // Initialize permissions Map with default permissions
|
|
147
|
-
|
|
131
|
+
constructor(userId /*: ParseUser | ParseRole | PermissionsMap*/) {
|
|
132
|
+
this.permissionsMap = {};
|
|
133
|
+
// Initialize permissions Map with default permissions
|
|
148
134
|
for (const [operation, group] of VALID_PERMISSIONS.entries()) {
|
|
149
135
|
this.permissionsMap[operation] = Object.assign({}, group);
|
|
150
136
|
const action = operation.charAt(0).toUpperCase() + operation.slice(1);
|
|
151
|
-
|
|
152
137
|
this[`get${action}RequiresAuthentication`] = function () {
|
|
153
138
|
return this._getAccess(operation, 'requiresAuthentication');
|
|
154
139
|
};
|
|
155
|
-
|
|
156
140
|
this[`set${action}RequiresAuthentication`] = function (allowed) {
|
|
157
141
|
this._setAccess(operation, 'requiresAuthentication', allowed);
|
|
158
142
|
};
|
|
159
|
-
|
|
160
143
|
this[`get${action}PointerFields`] = function () {
|
|
161
144
|
return this._getAccess(operation, 'pointerFields', false);
|
|
162
145
|
};
|
|
163
|
-
|
|
164
146
|
this[`set${action}PointerFields`] = function (pointerFields) {
|
|
165
147
|
this._setArrayAccess(operation, 'pointerFields', pointerFields);
|
|
166
148
|
};
|
|
167
|
-
|
|
168
149
|
this[`get${action}Access`] = function (entity) {
|
|
169
150
|
return this._getAccess(operation, entity);
|
|
170
151
|
};
|
|
171
|
-
|
|
172
152
|
this[`set${action}Access`] = function (entity, allowed) {
|
|
173
153
|
this._setAccess(operation, entity, allowed);
|
|
174
154
|
};
|
|
175
|
-
|
|
176
155
|
this[`getPublic${action}Access`] = function () {
|
|
177
156
|
return this[`get${action}Access`](PUBLIC_KEY);
|
|
178
157
|
};
|
|
179
|
-
|
|
180
158
|
this[`setPublic${action}Access`] = function (allowed) {
|
|
181
159
|
this[`set${action}Access`](PUBLIC_KEY, allowed);
|
|
182
160
|
};
|
|
183
|
-
|
|
184
161
|
this[`getRole${action}Access`] = function (role) {
|
|
185
162
|
return this[`get${action}Access`](this._getRoleName(role));
|
|
186
163
|
};
|
|
187
|
-
|
|
188
164
|
this[`setRole${action}Access`] = function (role, allowed) {
|
|
189
165
|
this[`set${action}Access`](this._getRoleName(role), allowed);
|
|
190
166
|
};
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
167
|
+
}
|
|
168
|
+
// Initialize permissions Map with default extended permissions
|
|
194
169
|
for (const [operation, group] of VALID_PERMISSIONS_EXTENDED.entries()) {
|
|
195
170
|
this.permissionsMap[operation] = Object.assign({}, group);
|
|
196
171
|
}
|
|
197
|
-
|
|
198
172
|
if (userId && typeof userId === 'object') {
|
|
199
173
|
if (userId instanceof _ParseUser.default) {
|
|
200
174
|
this.setReadAccess(userId, true);
|
|
@@ -208,11 +182,9 @@ class ParseCLP {
|
|
|
208
182
|
const isValidPermission = !!VALID_PERMISSIONS.get(permission);
|
|
209
183
|
const isValidPermissionExtended = !!VALID_PERMISSIONS_EXTENDED.get(permission);
|
|
210
184
|
const isValidGroupPermission = ['readUserFields', 'writeUserFields'].includes(permission);
|
|
211
|
-
|
|
212
185
|
if (typeof permission !== 'string' || !(isValidPermission || isValidPermissionExtended || isValidGroupPermission)) {
|
|
213
186
|
throw new TypeError('Tried to create an CLP with an invalid permission type.');
|
|
214
187
|
}
|
|
215
|
-
|
|
216
188
|
if (isValidGroupPermission) {
|
|
217
189
|
if (users.every(pointer => typeof pointer === 'string')) {
|
|
218
190
|
this.permissionsMap[permission] = users;
|
|
@@ -221,14 +193,11 @@ class ParseCLP {
|
|
|
221
193
|
throw new TypeError('Tried to create an CLP with an invalid permission value.');
|
|
222
194
|
}
|
|
223
195
|
}
|
|
224
|
-
|
|
225
196
|
for (const user in users) {
|
|
226
197
|
const allowed = users[user];
|
|
227
|
-
|
|
228
198
|
if (typeof allowed !== 'boolean' && !isValidPermissionExtended && user !== 'pointerFields') {
|
|
229
199
|
throw new TypeError('Tried to create an CLP with an invalid permission value.');
|
|
230
200
|
}
|
|
231
|
-
|
|
232
201
|
this.permissionsMap[permission][user] = allowed;
|
|
233
202
|
}
|
|
234
203
|
}
|
|
@@ -237,125 +206,85 @@ class ParseCLP {
|
|
|
237
206
|
throw new TypeError('ParseCLP constructed with a function. Did you forget ()?');
|
|
238
207
|
}
|
|
239
208
|
}
|
|
209
|
+
|
|
240
210
|
/**
|
|
241
211
|
* Returns a JSON-encoded version of the CLP.
|
|
242
212
|
*
|
|
243
213
|
* @returns {object}
|
|
244
214
|
*/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
/*: PermissionsMap*/
|
|
249
|
-
{
|
|
250
|
-
return { ...this.permissionsMap
|
|
215
|
+
toJSON() /*: PermissionsMap*/{
|
|
216
|
+
return {
|
|
217
|
+
...this.permissionsMap
|
|
251
218
|
};
|
|
252
219
|
}
|
|
220
|
+
|
|
253
221
|
/**
|
|
254
222
|
* Returns whether this CLP is equal to another object
|
|
255
223
|
*
|
|
256
224
|
* @param other The other object to compare to
|
|
257
225
|
* @returns {boolean}
|
|
258
226
|
*/
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
equals(other
|
|
262
|
-
/*: ParseCLP*/
|
|
263
|
-
)
|
|
264
|
-
/*: boolean*/
|
|
265
|
-
{
|
|
227
|
+
equals(other /*: ParseCLP*/) /*: boolean*/{
|
|
266
228
|
if (!(other instanceof ParseCLP)) {
|
|
267
229
|
return false;
|
|
268
230
|
}
|
|
269
|
-
|
|
270
231
|
const permissions = Object.keys(this.permissionsMap);
|
|
271
232
|
const otherPermissions = Object.keys(other.permissionsMap);
|
|
272
|
-
|
|
273
233
|
if (permissions.length !== otherPermissions.length) {
|
|
274
234
|
return false;
|
|
275
235
|
}
|
|
276
|
-
|
|
277
236
|
for (const permission in this.permissionsMap) {
|
|
278
237
|
if (!other.permissionsMap[permission]) {
|
|
279
238
|
return false;
|
|
280
239
|
}
|
|
281
|
-
|
|
282
240
|
const users = Object.keys(this.permissionsMap[permission]);
|
|
283
241
|
const otherUsers = Object.keys(other.permissionsMap[permission]);
|
|
284
|
-
|
|
285
242
|
if (users.length !== otherUsers.length) {
|
|
286
243
|
return false;
|
|
287
244
|
}
|
|
288
|
-
|
|
289
245
|
for (const user in this.permissionsMap[permission]) {
|
|
290
246
|
if (!other.permissionsMap[permission][user]) {
|
|
291
247
|
return false;
|
|
292
248
|
}
|
|
293
|
-
|
|
294
249
|
if (this.permissionsMap[permission][user] !== other.permissionsMap[permission][user]) {
|
|
295
250
|
return false;
|
|
296
251
|
}
|
|
297
252
|
}
|
|
298
253
|
}
|
|
299
|
-
|
|
300
254
|
return true;
|
|
301
255
|
}
|
|
302
|
-
|
|
303
|
-
_getRoleName(role
|
|
304
|
-
/*: ParseRole | string*/
|
|
305
|
-
)
|
|
306
|
-
/*: string*/
|
|
307
|
-
{
|
|
256
|
+
_getRoleName(role /*: ParseRole | string*/) /*: string*/{
|
|
308
257
|
let name = role;
|
|
309
|
-
|
|
310
258
|
if (role instanceof _ParseRole.default) {
|
|
311
259
|
// Normalize to the String name
|
|
312
260
|
name = role.getName();
|
|
313
261
|
}
|
|
314
|
-
|
|
315
262
|
if (typeof name !== 'string') {
|
|
316
263
|
throw new TypeError('role must be a Parse.Role or a String');
|
|
317
264
|
}
|
|
318
|
-
|
|
319
265
|
return `role:${name}`;
|
|
320
266
|
}
|
|
321
|
-
|
|
322
|
-
_parseEntity(entity
|
|
323
|
-
/*: Entity*/
|
|
324
|
-
) {
|
|
267
|
+
_parseEntity(entity /*: Entity*/) {
|
|
325
268
|
let userId = entity;
|
|
326
|
-
|
|
327
269
|
if (userId instanceof _ParseUser.default) {
|
|
328
270
|
userId = userId.id;
|
|
329
|
-
|
|
330
271
|
if (!userId) {
|
|
331
272
|
throw new Error('Cannot get access for a Parse.User without an id.');
|
|
332
273
|
}
|
|
333
274
|
} else if (userId instanceof _ParseRole.default) {
|
|
334
275
|
userId = this._getRoleName(userId);
|
|
335
276
|
}
|
|
336
|
-
|
|
337
277
|
if (typeof userId !== 'string') {
|
|
338
278
|
throw new TypeError('userId must be a string.');
|
|
339
279
|
}
|
|
340
|
-
|
|
341
280
|
return userId;
|
|
342
281
|
}
|
|
343
|
-
|
|
344
|
-
_setAccess(permission
|
|
345
|
-
/*: string*/
|
|
346
|
-
, userId
|
|
347
|
-
/*: Entity*/
|
|
348
|
-
, allowed
|
|
349
|
-
/*: boolean*/
|
|
350
|
-
) {
|
|
282
|
+
_setAccess(permission /*: string*/, userId /*: Entity*/, allowed /*: boolean*/) {
|
|
351
283
|
userId = this._parseEntity(userId);
|
|
352
|
-
|
|
353
284
|
if (typeof allowed !== 'boolean') {
|
|
354
285
|
throw new TypeError('allowed must be either true or false.');
|
|
355
286
|
}
|
|
356
|
-
|
|
357
287
|
const permissions = this.permissionsMap[permission][userId];
|
|
358
|
-
|
|
359
288
|
if (!permissions) {
|
|
360
289
|
if (!allowed) {
|
|
361
290
|
// The user already doesn't have this permission, so no action is needed
|
|
@@ -364,49 +293,29 @@ class ParseCLP {
|
|
|
364
293
|
this.permissionsMap[permission][userId] = {};
|
|
365
294
|
}
|
|
366
295
|
}
|
|
367
|
-
|
|
368
296
|
if (allowed) {
|
|
369
297
|
this.permissionsMap[permission][userId] = true;
|
|
370
298
|
} else {
|
|
371
299
|
delete this.permissionsMap[permission][userId];
|
|
372
300
|
}
|
|
373
301
|
}
|
|
374
|
-
|
|
375
|
-
_getAccess(permission
|
|
376
|
-
/*: string*/
|
|
377
|
-
, userId
|
|
378
|
-
/*: Entity*/
|
|
379
|
-
, returnBoolean = true)
|
|
380
|
-
/*: boolean | string[]*/
|
|
381
|
-
{
|
|
302
|
+
_getAccess(permission /*: string*/, userId /*: Entity*/, returnBoolean = true) /*: boolean | string[]*/{
|
|
382
303
|
userId = this._parseEntity(userId);
|
|
383
304
|
const permissions = this.permissionsMap[permission][userId];
|
|
384
|
-
|
|
385
305
|
if (returnBoolean) {
|
|
386
306
|
if (!permissions) {
|
|
387
307
|
return false;
|
|
388
308
|
}
|
|
389
|
-
|
|
390
309
|
return !!this.permissionsMap[permission][userId];
|
|
391
310
|
}
|
|
392
|
-
|
|
393
311
|
return permissions;
|
|
394
312
|
}
|
|
395
|
-
|
|
396
|
-
_setArrayAccess(permission
|
|
397
|
-
/*: string*/
|
|
398
|
-
, userId
|
|
399
|
-
/*: Entity*/
|
|
400
|
-
, fields
|
|
401
|
-
/*: string*/
|
|
402
|
-
) {
|
|
313
|
+
_setArrayAccess(permission /*: string*/, userId /*: Entity*/, fields /*: string*/) {
|
|
403
314
|
userId = this._parseEntity(userId);
|
|
404
315
|
const permissions = this.permissionsMap[permission][userId];
|
|
405
|
-
|
|
406
316
|
if (!permissions) {
|
|
407
317
|
this.permissionsMap[permission][userId] = [];
|
|
408
318
|
}
|
|
409
|
-
|
|
410
319
|
if (!fields || Array.isArray(fields) && fields.length === 0) {
|
|
411
320
|
delete this.permissionsMap[permission][userId];
|
|
412
321
|
} else if (Array.isArray(fields) && fields.every(field => typeof field === 'string')) {
|
|
@@ -415,18 +324,11 @@ class ParseCLP {
|
|
|
415
324
|
throw new TypeError('fields must be an array of strings or undefined.');
|
|
416
325
|
}
|
|
417
326
|
}
|
|
418
|
-
|
|
419
|
-
_setGroupPointerPermission(operation
|
|
420
|
-
/*: string*/
|
|
421
|
-
, pointerFields
|
|
422
|
-
/*: string[]*/
|
|
423
|
-
) {
|
|
327
|
+
_setGroupPointerPermission(operation /*: string*/, pointerFields /*: string[]*/) {
|
|
424
328
|
const fields = this.permissionsMap[operation];
|
|
425
|
-
|
|
426
329
|
if (!fields) {
|
|
427
330
|
this.permissionsMap[operation] = [];
|
|
428
331
|
}
|
|
429
|
-
|
|
430
332
|
if (!pointerFields || Array.isArray(pointerFields) && pointerFields.length === 0) {
|
|
431
333
|
delete this.permissionsMap[operation];
|
|
432
334
|
} else if (Array.isArray(pointerFields) && pointerFields.every(field => typeof field === 'string')) {
|
|
@@ -435,107 +337,74 @@ class ParseCLP {
|
|
|
435
337
|
throw new TypeError(`${operation}.pointerFields must be an array of strings or undefined.`);
|
|
436
338
|
}
|
|
437
339
|
}
|
|
438
|
-
|
|
439
|
-
_getGroupPointerPermissions(operation
|
|
440
|
-
/*: string*/
|
|
441
|
-
)
|
|
442
|
-
/*: string[]*/
|
|
443
|
-
{
|
|
340
|
+
_getGroupPointerPermissions(operation /*: string*/) /*: string[]*/{
|
|
444
341
|
return this.permissionsMap[operation];
|
|
445
342
|
}
|
|
343
|
+
|
|
446
344
|
/**
|
|
447
345
|
* Sets user pointer fields to allow permission for get/count/find operations.
|
|
448
346
|
*
|
|
449
347
|
* @param {string[]} pointerFields User pointer fields
|
|
450
348
|
*/
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
setReadUserFields(pointerFields
|
|
454
|
-
/*: string[]*/
|
|
455
|
-
) {
|
|
349
|
+
setReadUserFields(pointerFields /*: string[]*/) {
|
|
456
350
|
this._setGroupPointerPermission('readUserFields', pointerFields);
|
|
457
351
|
}
|
|
352
|
+
|
|
458
353
|
/**
|
|
459
354
|
* @returns {string[]} User pointer fields
|
|
460
355
|
*/
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
getReadUserFields()
|
|
464
|
-
/*: string[]*/
|
|
465
|
-
{
|
|
356
|
+
getReadUserFields() /*: string[]*/{
|
|
466
357
|
return this._getGroupPointerPermissions('readUserFields');
|
|
467
358
|
}
|
|
359
|
+
|
|
468
360
|
/**
|
|
469
361
|
* Sets user pointer fields to allow permission for create/delete/update/addField operations
|
|
470
362
|
*
|
|
471
363
|
* @param {string[]} pointerFields User pointer fields
|
|
472
364
|
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
setWriteUserFields(pointerFields
|
|
476
|
-
/*: string[]*/
|
|
477
|
-
) {
|
|
365
|
+
setWriteUserFields(pointerFields /*: string[]*/) {
|
|
478
366
|
this._setGroupPointerPermission('writeUserFields', pointerFields);
|
|
479
367
|
}
|
|
368
|
+
|
|
480
369
|
/**
|
|
481
370
|
* @returns {string[]} User pointer fields
|
|
482
371
|
*/
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
getWriteUserFields()
|
|
486
|
-
/*: string[]*/
|
|
487
|
-
{
|
|
372
|
+
getWriteUserFields() /*: string[]*/{
|
|
488
373
|
return this._getGroupPointerPermissions('writeUserFields');
|
|
489
374
|
}
|
|
375
|
+
|
|
490
376
|
/**
|
|
491
377
|
* Sets whether the given user is allowed to retrieve fields from this class.
|
|
492
378
|
*
|
|
493
379
|
* @param userId An instance of Parse.User or its objectId.
|
|
494
380
|
* @param {string[]} fields fields to be protected
|
|
495
381
|
*/
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
setProtectedFields(userId
|
|
499
|
-
/*: Entity*/
|
|
500
|
-
, fields
|
|
501
|
-
/*: string[]*/
|
|
502
|
-
) {
|
|
382
|
+
setProtectedFields(userId /*: Entity*/, fields /*: string[]*/) {
|
|
503
383
|
this._setArrayAccess('protectedFields', userId, fields);
|
|
504
384
|
}
|
|
385
|
+
|
|
505
386
|
/**
|
|
506
387
|
* Returns array of fields are accessable to this user.
|
|
507
388
|
*
|
|
508
389
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
|
|
509
390
|
* @returns {string[]}
|
|
510
391
|
*/
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
getProtectedFields(userId
|
|
514
|
-
/*: Entity*/
|
|
515
|
-
)
|
|
516
|
-
/*: string[]*/
|
|
517
|
-
{
|
|
392
|
+
getProtectedFields(userId /*: Entity*/) /*: string[]*/{
|
|
518
393
|
return this._getAccess('protectedFields', userId, false);
|
|
519
394
|
}
|
|
395
|
+
|
|
520
396
|
/**
|
|
521
397
|
* Sets whether the given user is allowed to read from this class.
|
|
522
398
|
*
|
|
523
399
|
* @param userId An instance of Parse.User or its objectId.
|
|
524
400
|
* @param {boolean} allowed whether that user should have read access.
|
|
525
401
|
*/
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
setReadAccess(userId
|
|
529
|
-
/*: Entity*/
|
|
530
|
-
, allowed
|
|
531
|
-
/*: boolean*/
|
|
532
|
-
) {
|
|
402
|
+
setReadAccess(userId /*: Entity*/, allowed /*: boolean*/) {
|
|
533
403
|
this._setAccess('find', userId, allowed);
|
|
534
|
-
|
|
535
404
|
this._setAccess('get', userId, allowed);
|
|
536
|
-
|
|
537
405
|
this._setAccess('count', userId, allowed);
|
|
538
406
|
}
|
|
407
|
+
|
|
539
408
|
/**
|
|
540
409
|
* Get whether the given user id is *explicitly* allowed to read from this class.
|
|
541
410
|
* Even if this returns false, the user may still be able to access it if
|
|
@@ -545,36 +414,23 @@ class ParseCLP {
|
|
|
545
414
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
|
|
546
415
|
* @returns {boolean}
|
|
547
416
|
*/
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
getReadAccess(userId
|
|
551
|
-
/*: Entity*/
|
|
552
|
-
)
|
|
553
|
-
/*: boolean*/
|
|
554
|
-
{
|
|
417
|
+
getReadAccess(userId /*: Entity*/) /*: boolean*/{
|
|
555
418
|
return this._getAccess('find', userId) && this._getAccess('get', userId) && this._getAccess('count', userId);
|
|
556
419
|
}
|
|
420
|
+
|
|
557
421
|
/**
|
|
558
422
|
* Sets whether the given user id is allowed to write to this class.
|
|
559
423
|
*
|
|
560
424
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role..
|
|
561
425
|
* @param {boolean} allowed Whether that user should have write access.
|
|
562
426
|
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
setWriteAccess(userId
|
|
566
|
-
/*: Entity*/
|
|
567
|
-
, allowed
|
|
568
|
-
/*: boolean*/
|
|
569
|
-
) {
|
|
427
|
+
setWriteAccess(userId /*: Entity*/, allowed /*: boolean*/) {
|
|
570
428
|
this._setAccess('create', userId, allowed);
|
|
571
|
-
|
|
572
429
|
this._setAccess('update', userId, allowed);
|
|
573
|
-
|
|
574
430
|
this._setAccess('delete', userId, allowed);
|
|
575
|
-
|
|
576
431
|
this._setAccess('addField', userId, allowed);
|
|
577
432
|
}
|
|
433
|
+
|
|
578
434
|
/**
|
|
579
435
|
* Gets whether the given user id is *explicitly* allowed to write to this class.
|
|
580
436
|
* Even if this returns false, the user may still be able to write it if
|
|
@@ -584,87 +440,64 @@ class ParseCLP {
|
|
|
584
440
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
|
|
585
441
|
* @returns {boolean}
|
|
586
442
|
*/
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
getWriteAccess(userId
|
|
590
|
-
/*: Entity*/
|
|
591
|
-
)
|
|
592
|
-
/*: boolean*/
|
|
593
|
-
{
|
|
443
|
+
getWriteAccess(userId /*: Entity*/) /*: boolean*/{
|
|
594
444
|
return this._getAccess('create', userId) && this._getAccess('update', userId) && this._getAccess('delete', userId) && this._getAccess('addField', userId);
|
|
595
445
|
}
|
|
446
|
+
|
|
596
447
|
/**
|
|
597
448
|
* Sets whether the public is allowed to read from this class.
|
|
598
449
|
*
|
|
599
450
|
* @param {boolean} allowed
|
|
600
451
|
*/
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
setPublicReadAccess(allowed
|
|
604
|
-
/*: boolean*/
|
|
605
|
-
) {
|
|
452
|
+
setPublicReadAccess(allowed /*: boolean*/) {
|
|
606
453
|
this.setReadAccess(PUBLIC_KEY, allowed);
|
|
607
454
|
}
|
|
455
|
+
|
|
608
456
|
/**
|
|
609
457
|
* Gets whether the public is allowed to read from this class.
|
|
610
458
|
*
|
|
611
459
|
* @returns {boolean}
|
|
612
460
|
*/
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
getPublicReadAccess()
|
|
616
|
-
/*: boolean*/
|
|
617
|
-
{
|
|
461
|
+
getPublicReadAccess() /*: boolean*/{
|
|
618
462
|
return this.getReadAccess(PUBLIC_KEY);
|
|
619
463
|
}
|
|
464
|
+
|
|
620
465
|
/**
|
|
621
466
|
* Sets whether the public is allowed to write to this class.
|
|
622
467
|
*
|
|
623
468
|
* @param {boolean} allowed
|
|
624
469
|
*/
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
setPublicWriteAccess(allowed
|
|
628
|
-
/*: boolean*/
|
|
629
|
-
) {
|
|
470
|
+
setPublicWriteAccess(allowed /*: boolean*/) {
|
|
630
471
|
this.setWriteAccess(PUBLIC_KEY, allowed);
|
|
631
472
|
}
|
|
473
|
+
|
|
632
474
|
/**
|
|
633
475
|
* Gets whether the public is allowed to write to this class.
|
|
634
476
|
*
|
|
635
477
|
* @returns {boolean}
|
|
636
478
|
*/
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
getPublicWriteAccess()
|
|
640
|
-
/*: boolean*/
|
|
641
|
-
{
|
|
479
|
+
getPublicWriteAccess() /*: boolean*/{
|
|
642
480
|
return this.getWriteAccess(PUBLIC_KEY);
|
|
643
481
|
}
|
|
482
|
+
|
|
644
483
|
/**
|
|
645
484
|
* Sets whether the public is allowed to protect fields in this class.
|
|
646
485
|
*
|
|
647
486
|
* @param {string[]} fields
|
|
648
487
|
*/
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
setPublicProtectedFields(fields
|
|
652
|
-
/*: string[]*/
|
|
653
|
-
) {
|
|
488
|
+
setPublicProtectedFields(fields /*: string[]*/) {
|
|
654
489
|
this.setProtectedFields(PUBLIC_KEY, fields);
|
|
655
490
|
}
|
|
491
|
+
|
|
656
492
|
/**
|
|
657
493
|
* Gets whether the public is allowed to read fields from this class.
|
|
658
494
|
*
|
|
659
495
|
* @returns {string[]}
|
|
660
496
|
*/
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
getPublicProtectedFields()
|
|
664
|
-
/*: string[]*/
|
|
665
|
-
{
|
|
497
|
+
getPublicProtectedFields() /*: string[]*/{
|
|
666
498
|
return this.getProtectedFields(PUBLIC_KEY);
|
|
667
499
|
}
|
|
500
|
+
|
|
668
501
|
/**
|
|
669
502
|
* Gets whether users belonging to the given role are allowed
|
|
670
503
|
* to read from this class. Even if this returns false, the role may
|
|
@@ -674,15 +507,10 @@ class ParseCLP {
|
|
|
674
507
|
* @returns {boolean} true if the role has read access. false otherwise.
|
|
675
508
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
676
509
|
*/
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
getRoleReadAccess(role
|
|
680
|
-
/*: ParseRole | string*/
|
|
681
|
-
)
|
|
682
|
-
/*: boolean*/
|
|
683
|
-
{
|
|
510
|
+
getRoleReadAccess(role /*: ParseRole | string*/) /*: boolean*/{
|
|
684
511
|
return this.getReadAccess(this._getRoleName(role));
|
|
685
512
|
}
|
|
513
|
+
|
|
686
514
|
/**
|
|
687
515
|
* Gets whether users belonging to the given role are allowed
|
|
688
516
|
* to write to this user. Even if this returns false, the role may
|
|
@@ -692,15 +520,10 @@ class ParseCLP {
|
|
|
692
520
|
* @returns {boolean} true if the role has write access. false otherwise.
|
|
693
521
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
694
522
|
*/
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
getRoleWriteAccess(role
|
|
698
|
-
/*: ParseRole | string*/
|
|
699
|
-
)
|
|
700
|
-
/*: boolean*/
|
|
701
|
-
{
|
|
523
|
+
getRoleWriteAccess(role /*: ParseRole | string*/) /*: boolean*/{
|
|
702
524
|
return this.getWriteAccess(this._getRoleName(role));
|
|
703
525
|
}
|
|
526
|
+
|
|
704
527
|
/**
|
|
705
528
|
* Sets whether users belonging to the given role are allowed
|
|
706
529
|
* to read from this class.
|
|
@@ -709,15 +532,10 @@ class ParseCLP {
|
|
|
709
532
|
* @param {boolean} allowed Whether the given role can read this object.
|
|
710
533
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
711
534
|
*/
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
setRoleReadAccess(role
|
|
715
|
-
/*: ParseRole | string*/
|
|
716
|
-
, allowed
|
|
717
|
-
/*: boolean*/
|
|
718
|
-
) {
|
|
535
|
+
setRoleReadAccess(role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
719
536
|
this.setReadAccess(this._getRoleName(role), allowed);
|
|
720
537
|
}
|
|
538
|
+
|
|
721
539
|
/**
|
|
722
540
|
* Sets whether users belonging to the given role are allowed
|
|
723
541
|
* to write to this class.
|
|
@@ -726,15 +544,10 @@ class ParseCLP {
|
|
|
726
544
|
* @param {boolean} allowed Whether the given role can write this object.
|
|
727
545
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
728
546
|
*/
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
setRoleWriteAccess(role
|
|
732
|
-
/*: ParseRole | string*/
|
|
733
|
-
, allowed
|
|
734
|
-
/*: boolean*/
|
|
735
|
-
) {
|
|
547
|
+
setRoleWriteAccess(role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
736
548
|
this.setWriteAccess(this._getRoleName(role), allowed);
|
|
737
549
|
}
|
|
550
|
+
|
|
738
551
|
/**
|
|
739
552
|
* Gets whether users belonging to the given role are allowed
|
|
740
553
|
* to count to this user. Even if this returns false, the role may
|
|
@@ -744,15 +557,10 @@ class ParseCLP {
|
|
|
744
557
|
* @returns {string[]}
|
|
745
558
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
746
559
|
*/
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
getRoleProtectedFields(role
|
|
750
|
-
/*: ParseRole | string*/
|
|
751
|
-
)
|
|
752
|
-
/*: string[]*/
|
|
753
|
-
{
|
|
560
|
+
getRoleProtectedFields(role /*: ParseRole | string*/) /*: string[]*/{
|
|
754
561
|
return this.getProtectedFields(this._getRoleName(role));
|
|
755
562
|
}
|
|
563
|
+
|
|
756
564
|
/**
|
|
757
565
|
* Sets whether users belonging to the given role are allowed
|
|
758
566
|
* to set access field in this class.
|
|
@@ -761,17 +569,9 @@ class ParseCLP {
|
|
|
761
569
|
* @param {string[]} fields Fields to be protected by Role.
|
|
762
570
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
763
571
|
*/
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
setRoleProtectedFields(role
|
|
767
|
-
/*: ParseRole | string*/
|
|
768
|
-
, fields
|
|
769
|
-
/*: string[]*/
|
|
770
|
-
) {
|
|
572
|
+
setRoleProtectedFields(role /*: ParseRole | string*/, fields /*: string[]*/) {
|
|
771
573
|
this.setProtectedFields(this._getRoleName(role), fields);
|
|
772
574
|
}
|
|
773
|
-
|
|
774
575
|
}
|
|
775
|
-
|
|
776
576
|
var _default = ParseCLP;
|
|
777
577
|
exports.default = _default;
|