parse 3.5.1 → 4.0.0-alpha.10
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 +20 -7
- 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 +18 -134
- 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 +73 -302
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +55 -244
- 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 +234 -997
- 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 +19 -169
- 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 +37 -30
- package/PATENTS +0 -37
package/lib/node/ParseCLP.js
CHANGED
|
@@ -4,62 +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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (Object.getOwnPropertySymbols) {
|
|
22
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
23
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
24
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
25
|
-
})), keys.push.apply(keys, symbols);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return keys;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _objectSpread(target) {
|
|
32
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
33
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
34
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
35
|
-
_defineProperty(target, key, source[key]);
|
|
36
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
37
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return target;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _defineProperty(obj, key, value) {
|
|
45
|
-
if (key in obj) {
|
|
46
|
-
Object.defineProperty(obj, key, {
|
|
47
|
-
value: value,
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
obj[key] = value;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return obj;
|
|
57
|
-
}
|
|
14
|
+
/**
|
|
15
|
+
* @flow
|
|
16
|
+
*/
|
|
58
17
|
|
|
59
18
|
const PUBLIC_KEY = '*';
|
|
60
|
-
const VALID_PERMISSIONS
|
|
61
|
-
|
|
62
|
-
|
|
19
|
+
const VALID_PERMISSIONS /*: Map<string, UsersMap>*/ = new Map(
|
|
20
|
+
/*:: <string, UsersMap>*/
|
|
21
|
+
);
|
|
63
22
|
VALID_PERMISSIONS.set('get', {});
|
|
64
23
|
VALID_PERMISSIONS.set('find', {});
|
|
65
24
|
VALID_PERMISSIONS.set('count', {});
|
|
@@ -67,10 +26,11 @@ VALID_PERMISSIONS.set('create', {});
|
|
|
67
26
|
VALID_PERMISSIONS.set('update', {});
|
|
68
27
|
VALID_PERMISSIONS.set('delete', {});
|
|
69
28
|
VALID_PERMISSIONS.set('addField', {});
|
|
70
|
-
const VALID_PERMISSIONS_EXTENDED
|
|
71
|
-
|
|
72
|
-
|
|
29
|
+
const VALID_PERMISSIONS_EXTENDED /*: Map<string, UsersMap>*/ = new Map(
|
|
30
|
+
/*:: <string, UsersMap>*/
|
|
31
|
+
);
|
|
73
32
|
VALID_PERMISSIONS_EXTENDED.set('protectedFields', {});
|
|
33
|
+
|
|
74
34
|
/**
|
|
75
35
|
* Creates a new CLP.
|
|
76
36
|
* If no argument is given, the CLP has no permissions for anyone.
|
|
@@ -163,68 +123,52 @@ VALID_PERMISSIONS_EXTENDED.set('protectedFields', {});
|
|
|
163
123
|
*
|
|
164
124
|
* @alias Parse.CLP
|
|
165
125
|
*/
|
|
166
|
-
|
|
167
126
|
class ParseCLP {
|
|
168
127
|
/*:: permissionsMap: PermissionsMap;*/
|
|
169
|
-
|
|
170
128
|
/**
|
|
171
129
|
* @param {(Parse.User | Parse.Role | object)} userId The user to initialize the CLP for
|
|
172
130
|
*/
|
|
173
|
-
constructor(userId
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
this.permissionsMap = {}; // Initialize permissions Map with default permissions
|
|
177
|
-
|
|
131
|
+
constructor(userId /*: ParseUser | ParseRole | PermissionsMap*/) {
|
|
132
|
+
this.permissionsMap = {};
|
|
133
|
+
// Initialize permissions Map with default permissions
|
|
178
134
|
for (const [operation, group] of VALID_PERMISSIONS.entries()) {
|
|
179
135
|
this.permissionsMap[operation] = Object.assign({}, group);
|
|
180
136
|
const action = operation.charAt(0).toUpperCase() + operation.slice(1);
|
|
181
|
-
|
|
182
137
|
this[`get${action}RequiresAuthentication`] = function () {
|
|
183
138
|
return this._getAccess(operation, 'requiresAuthentication');
|
|
184
139
|
};
|
|
185
|
-
|
|
186
140
|
this[`set${action}RequiresAuthentication`] = function (allowed) {
|
|
187
141
|
this._setAccess(operation, 'requiresAuthentication', allowed);
|
|
188
142
|
};
|
|
189
|
-
|
|
190
143
|
this[`get${action}PointerFields`] = function () {
|
|
191
144
|
return this._getAccess(operation, 'pointerFields', false);
|
|
192
145
|
};
|
|
193
|
-
|
|
194
146
|
this[`set${action}PointerFields`] = function (pointerFields) {
|
|
195
147
|
this._setArrayAccess(operation, 'pointerFields', pointerFields);
|
|
196
148
|
};
|
|
197
|
-
|
|
198
149
|
this[`get${action}Access`] = function (entity) {
|
|
199
150
|
return this._getAccess(operation, entity);
|
|
200
151
|
};
|
|
201
|
-
|
|
202
152
|
this[`set${action}Access`] = function (entity, allowed) {
|
|
203
153
|
this._setAccess(operation, entity, allowed);
|
|
204
154
|
};
|
|
205
|
-
|
|
206
155
|
this[`getPublic${action}Access`] = function () {
|
|
207
156
|
return this[`get${action}Access`](PUBLIC_KEY);
|
|
208
157
|
};
|
|
209
|
-
|
|
210
158
|
this[`setPublic${action}Access`] = function (allowed) {
|
|
211
159
|
this[`set${action}Access`](PUBLIC_KEY, allowed);
|
|
212
160
|
};
|
|
213
|
-
|
|
214
161
|
this[`getRole${action}Access`] = function (role) {
|
|
215
162
|
return this[`get${action}Access`](this._getRoleName(role));
|
|
216
163
|
};
|
|
217
|
-
|
|
218
164
|
this[`setRole${action}Access`] = function (role, allowed) {
|
|
219
165
|
this[`set${action}Access`](this._getRoleName(role), allowed);
|
|
220
166
|
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
167
|
+
}
|
|
168
|
+
// Initialize permissions Map with default extended permissions
|
|
224
169
|
for (const [operation, group] of VALID_PERMISSIONS_EXTENDED.entries()) {
|
|
225
170
|
this.permissionsMap[operation] = Object.assign({}, group);
|
|
226
171
|
}
|
|
227
|
-
|
|
228
172
|
if (userId && typeof userId === 'object') {
|
|
229
173
|
if (userId instanceof _ParseUser.default) {
|
|
230
174
|
this.setReadAccess(userId, true);
|
|
@@ -238,11 +182,9 @@ class ParseCLP {
|
|
|
238
182
|
const isValidPermission = !!VALID_PERMISSIONS.get(permission);
|
|
239
183
|
const isValidPermissionExtended = !!VALID_PERMISSIONS_EXTENDED.get(permission);
|
|
240
184
|
const isValidGroupPermission = ['readUserFields', 'writeUserFields'].includes(permission);
|
|
241
|
-
|
|
242
185
|
if (typeof permission !== 'string' || !(isValidPermission || isValidPermissionExtended || isValidGroupPermission)) {
|
|
243
186
|
throw new TypeError('Tried to create an CLP with an invalid permission type.');
|
|
244
187
|
}
|
|
245
|
-
|
|
246
188
|
if (isValidGroupPermission) {
|
|
247
189
|
if (users.every(pointer => typeof pointer === 'string')) {
|
|
248
190
|
this.permissionsMap[permission] = users;
|
|
@@ -251,14 +193,11 @@ class ParseCLP {
|
|
|
251
193
|
throw new TypeError('Tried to create an CLP with an invalid permission value.');
|
|
252
194
|
}
|
|
253
195
|
}
|
|
254
|
-
|
|
255
196
|
for (const user in users) {
|
|
256
197
|
const allowed = users[user];
|
|
257
|
-
|
|
258
198
|
if (typeof allowed !== 'boolean' && !isValidPermissionExtended && user !== 'pointerFields') {
|
|
259
199
|
throw new TypeError('Tried to create an CLP with an invalid permission value.');
|
|
260
200
|
}
|
|
261
|
-
|
|
262
201
|
this.permissionsMap[permission][user] = allowed;
|
|
263
202
|
}
|
|
264
203
|
}
|
|
@@ -267,124 +206,85 @@ class ParseCLP {
|
|
|
267
206
|
throw new TypeError('ParseCLP constructed with a function. Did you forget ()?');
|
|
268
207
|
}
|
|
269
208
|
}
|
|
209
|
+
|
|
270
210
|
/**
|
|
271
211
|
* Returns a JSON-encoded version of the CLP.
|
|
272
212
|
*
|
|
273
213
|
* @returns {object}
|
|
274
214
|
*/
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
{
|
|
280
|
-
return _objectSpread({}, this.permissionsMap);
|
|
215
|
+
toJSON() /*: PermissionsMap*/{
|
|
216
|
+
return {
|
|
217
|
+
...this.permissionsMap
|
|
218
|
+
};
|
|
281
219
|
}
|
|
220
|
+
|
|
282
221
|
/**
|
|
283
222
|
* Returns whether this CLP is equal to another object
|
|
284
223
|
*
|
|
285
224
|
* @param other The other object to compare to
|
|
286
225
|
* @returns {boolean}
|
|
287
226
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
equals(other
|
|
291
|
-
/*: ParseCLP*/
|
|
292
|
-
)
|
|
293
|
-
/*: boolean*/
|
|
294
|
-
{
|
|
227
|
+
equals(other /*: ParseCLP*/) /*: boolean*/{
|
|
295
228
|
if (!(other instanceof ParseCLP)) {
|
|
296
229
|
return false;
|
|
297
230
|
}
|
|
298
|
-
|
|
299
231
|
const permissions = Object.keys(this.permissionsMap);
|
|
300
232
|
const otherPermissions = Object.keys(other.permissionsMap);
|
|
301
|
-
|
|
302
233
|
if (permissions.length !== otherPermissions.length) {
|
|
303
234
|
return false;
|
|
304
235
|
}
|
|
305
|
-
|
|
306
236
|
for (const permission in this.permissionsMap) {
|
|
307
237
|
if (!other.permissionsMap[permission]) {
|
|
308
238
|
return false;
|
|
309
239
|
}
|
|
310
|
-
|
|
311
240
|
const users = Object.keys(this.permissionsMap[permission]);
|
|
312
241
|
const otherUsers = Object.keys(other.permissionsMap[permission]);
|
|
313
|
-
|
|
314
242
|
if (users.length !== otherUsers.length) {
|
|
315
243
|
return false;
|
|
316
244
|
}
|
|
317
|
-
|
|
318
245
|
for (const user in this.permissionsMap[permission]) {
|
|
319
246
|
if (!other.permissionsMap[permission][user]) {
|
|
320
247
|
return false;
|
|
321
248
|
}
|
|
322
|
-
|
|
323
249
|
if (this.permissionsMap[permission][user] !== other.permissionsMap[permission][user]) {
|
|
324
250
|
return false;
|
|
325
251
|
}
|
|
326
252
|
}
|
|
327
253
|
}
|
|
328
|
-
|
|
329
254
|
return true;
|
|
330
255
|
}
|
|
331
|
-
|
|
332
|
-
_getRoleName(role
|
|
333
|
-
/*: ParseRole | string*/
|
|
334
|
-
)
|
|
335
|
-
/*: string*/
|
|
336
|
-
{
|
|
256
|
+
_getRoleName(role /*: ParseRole | string*/) /*: string*/{
|
|
337
257
|
let name = role;
|
|
338
|
-
|
|
339
258
|
if (role instanceof _ParseRole.default) {
|
|
340
259
|
// Normalize to the String name
|
|
341
260
|
name = role.getName();
|
|
342
261
|
}
|
|
343
|
-
|
|
344
262
|
if (typeof name !== 'string') {
|
|
345
263
|
throw new TypeError('role must be a Parse.Role or a String');
|
|
346
264
|
}
|
|
347
|
-
|
|
348
265
|
return `role:${name}`;
|
|
349
266
|
}
|
|
350
|
-
|
|
351
|
-
_parseEntity(entity
|
|
352
|
-
/*: Entity*/
|
|
353
|
-
) {
|
|
267
|
+
_parseEntity(entity /*: Entity*/) {
|
|
354
268
|
let userId = entity;
|
|
355
|
-
|
|
356
269
|
if (userId instanceof _ParseUser.default) {
|
|
357
270
|
userId = userId.id;
|
|
358
|
-
|
|
359
271
|
if (!userId) {
|
|
360
272
|
throw new Error('Cannot get access for a Parse.User without an id.');
|
|
361
273
|
}
|
|
362
274
|
} else if (userId instanceof _ParseRole.default) {
|
|
363
275
|
userId = this._getRoleName(userId);
|
|
364
276
|
}
|
|
365
|
-
|
|
366
277
|
if (typeof userId !== 'string') {
|
|
367
278
|
throw new TypeError('userId must be a string.');
|
|
368
279
|
}
|
|
369
|
-
|
|
370
280
|
return userId;
|
|
371
281
|
}
|
|
372
|
-
|
|
373
|
-
_setAccess(permission
|
|
374
|
-
/*: string*/
|
|
375
|
-
, userId
|
|
376
|
-
/*: Entity*/
|
|
377
|
-
, allowed
|
|
378
|
-
/*: boolean*/
|
|
379
|
-
) {
|
|
282
|
+
_setAccess(permission /*: string*/, userId /*: Entity*/, allowed /*: boolean*/) {
|
|
380
283
|
userId = this._parseEntity(userId);
|
|
381
|
-
|
|
382
284
|
if (typeof allowed !== 'boolean') {
|
|
383
285
|
throw new TypeError('allowed must be either true or false.');
|
|
384
286
|
}
|
|
385
|
-
|
|
386
287
|
const permissions = this.permissionsMap[permission][userId];
|
|
387
|
-
|
|
388
288
|
if (!permissions) {
|
|
389
289
|
if (!allowed) {
|
|
390
290
|
// The user already doesn't have this permission, so no action is needed
|
|
@@ -393,49 +293,29 @@ class ParseCLP {
|
|
|
393
293
|
this.permissionsMap[permission][userId] = {};
|
|
394
294
|
}
|
|
395
295
|
}
|
|
396
|
-
|
|
397
296
|
if (allowed) {
|
|
398
297
|
this.permissionsMap[permission][userId] = true;
|
|
399
298
|
} else {
|
|
400
299
|
delete this.permissionsMap[permission][userId];
|
|
401
300
|
}
|
|
402
301
|
}
|
|
403
|
-
|
|
404
|
-
_getAccess(permission
|
|
405
|
-
/*: string*/
|
|
406
|
-
, userId
|
|
407
|
-
/*: Entity*/
|
|
408
|
-
, returnBoolean = true)
|
|
409
|
-
/*: boolean | string[]*/
|
|
410
|
-
{
|
|
302
|
+
_getAccess(permission /*: string*/, userId /*: Entity*/, returnBoolean = true) /*: boolean | string[]*/{
|
|
411
303
|
userId = this._parseEntity(userId);
|
|
412
304
|
const permissions = this.permissionsMap[permission][userId];
|
|
413
|
-
|
|
414
305
|
if (returnBoolean) {
|
|
415
306
|
if (!permissions) {
|
|
416
307
|
return false;
|
|
417
308
|
}
|
|
418
|
-
|
|
419
309
|
return !!this.permissionsMap[permission][userId];
|
|
420
310
|
}
|
|
421
|
-
|
|
422
311
|
return permissions;
|
|
423
312
|
}
|
|
424
|
-
|
|
425
|
-
_setArrayAccess(permission
|
|
426
|
-
/*: string*/
|
|
427
|
-
, userId
|
|
428
|
-
/*: Entity*/
|
|
429
|
-
, fields
|
|
430
|
-
/*: string*/
|
|
431
|
-
) {
|
|
313
|
+
_setArrayAccess(permission /*: string*/, userId /*: Entity*/, fields /*: string*/) {
|
|
432
314
|
userId = this._parseEntity(userId);
|
|
433
315
|
const permissions = this.permissionsMap[permission][userId];
|
|
434
|
-
|
|
435
316
|
if (!permissions) {
|
|
436
317
|
this.permissionsMap[permission][userId] = [];
|
|
437
318
|
}
|
|
438
|
-
|
|
439
319
|
if (!fields || Array.isArray(fields) && fields.length === 0) {
|
|
440
320
|
delete this.permissionsMap[permission][userId];
|
|
441
321
|
} else if (Array.isArray(fields) && fields.every(field => typeof field === 'string')) {
|
|
@@ -444,18 +324,11 @@ class ParseCLP {
|
|
|
444
324
|
throw new TypeError('fields must be an array of strings or undefined.');
|
|
445
325
|
}
|
|
446
326
|
}
|
|
447
|
-
|
|
448
|
-
_setGroupPointerPermission(operation
|
|
449
|
-
/*: string*/
|
|
450
|
-
, pointerFields
|
|
451
|
-
/*: string[]*/
|
|
452
|
-
) {
|
|
327
|
+
_setGroupPointerPermission(operation /*: string*/, pointerFields /*: string[]*/) {
|
|
453
328
|
const fields = this.permissionsMap[operation];
|
|
454
|
-
|
|
455
329
|
if (!fields) {
|
|
456
330
|
this.permissionsMap[operation] = [];
|
|
457
331
|
}
|
|
458
|
-
|
|
459
332
|
if (!pointerFields || Array.isArray(pointerFields) && pointerFields.length === 0) {
|
|
460
333
|
delete this.permissionsMap[operation];
|
|
461
334
|
} else if (Array.isArray(pointerFields) && pointerFields.every(field => typeof field === 'string')) {
|
|
@@ -464,107 +337,74 @@ class ParseCLP {
|
|
|
464
337
|
throw new TypeError(`${operation}.pointerFields must be an array of strings or undefined.`);
|
|
465
338
|
}
|
|
466
339
|
}
|
|
467
|
-
|
|
468
|
-
_getGroupPointerPermissions(operation
|
|
469
|
-
/*: string*/
|
|
470
|
-
)
|
|
471
|
-
/*: string[]*/
|
|
472
|
-
{
|
|
340
|
+
_getGroupPointerPermissions(operation /*: string*/) /*: string[]*/{
|
|
473
341
|
return this.permissionsMap[operation];
|
|
474
342
|
}
|
|
343
|
+
|
|
475
344
|
/**
|
|
476
345
|
* Sets user pointer fields to allow permission for get/count/find operations.
|
|
477
346
|
*
|
|
478
347
|
* @param {string[]} pointerFields User pointer fields
|
|
479
348
|
*/
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
setReadUserFields(pointerFields
|
|
483
|
-
/*: string[]*/
|
|
484
|
-
) {
|
|
349
|
+
setReadUserFields(pointerFields /*: string[]*/) {
|
|
485
350
|
this._setGroupPointerPermission('readUserFields', pointerFields);
|
|
486
351
|
}
|
|
352
|
+
|
|
487
353
|
/**
|
|
488
354
|
* @returns {string[]} User pointer fields
|
|
489
355
|
*/
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
getReadUserFields()
|
|
493
|
-
/*: string[]*/
|
|
494
|
-
{
|
|
356
|
+
getReadUserFields() /*: string[]*/{
|
|
495
357
|
return this._getGroupPointerPermissions('readUserFields');
|
|
496
358
|
}
|
|
359
|
+
|
|
497
360
|
/**
|
|
498
361
|
* Sets user pointer fields to allow permission for create/delete/update/addField operations
|
|
499
362
|
*
|
|
500
363
|
* @param {string[]} pointerFields User pointer fields
|
|
501
364
|
*/
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
setWriteUserFields(pointerFields
|
|
505
|
-
/*: string[]*/
|
|
506
|
-
) {
|
|
365
|
+
setWriteUserFields(pointerFields /*: string[]*/) {
|
|
507
366
|
this._setGroupPointerPermission('writeUserFields', pointerFields);
|
|
508
367
|
}
|
|
368
|
+
|
|
509
369
|
/**
|
|
510
370
|
* @returns {string[]} User pointer fields
|
|
511
371
|
*/
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
getWriteUserFields()
|
|
515
|
-
/*: string[]*/
|
|
516
|
-
{
|
|
372
|
+
getWriteUserFields() /*: string[]*/{
|
|
517
373
|
return this._getGroupPointerPermissions('writeUserFields');
|
|
518
374
|
}
|
|
375
|
+
|
|
519
376
|
/**
|
|
520
377
|
* Sets whether the given user is allowed to retrieve fields from this class.
|
|
521
378
|
*
|
|
522
379
|
* @param userId An instance of Parse.User or its objectId.
|
|
523
380
|
* @param {string[]} fields fields to be protected
|
|
524
381
|
*/
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
setProtectedFields(userId
|
|
528
|
-
/*: Entity*/
|
|
529
|
-
, fields
|
|
530
|
-
/*: string[]*/
|
|
531
|
-
) {
|
|
382
|
+
setProtectedFields(userId /*: Entity*/, fields /*: string[]*/) {
|
|
532
383
|
this._setArrayAccess('protectedFields', userId, fields);
|
|
533
384
|
}
|
|
385
|
+
|
|
534
386
|
/**
|
|
535
387
|
* Returns array of fields are accessable to this user.
|
|
536
388
|
*
|
|
537
389
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
|
|
538
390
|
* @returns {string[]}
|
|
539
391
|
*/
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
getProtectedFields(userId
|
|
543
|
-
/*: Entity*/
|
|
544
|
-
)
|
|
545
|
-
/*: string[]*/
|
|
546
|
-
{
|
|
392
|
+
getProtectedFields(userId /*: Entity*/) /*: string[]*/{
|
|
547
393
|
return this._getAccess('protectedFields', userId, false);
|
|
548
394
|
}
|
|
395
|
+
|
|
549
396
|
/**
|
|
550
397
|
* Sets whether the given user is allowed to read from this class.
|
|
551
398
|
*
|
|
552
399
|
* @param userId An instance of Parse.User or its objectId.
|
|
553
400
|
* @param {boolean} allowed whether that user should have read access.
|
|
554
401
|
*/
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
setReadAccess(userId
|
|
558
|
-
/*: Entity*/
|
|
559
|
-
, allowed
|
|
560
|
-
/*: boolean*/
|
|
561
|
-
) {
|
|
402
|
+
setReadAccess(userId /*: Entity*/, allowed /*: boolean*/) {
|
|
562
403
|
this._setAccess('find', userId, allowed);
|
|
563
|
-
|
|
564
404
|
this._setAccess('get', userId, allowed);
|
|
565
|
-
|
|
566
405
|
this._setAccess('count', userId, allowed);
|
|
567
406
|
}
|
|
407
|
+
|
|
568
408
|
/**
|
|
569
409
|
* Get whether the given user id is *explicitly* allowed to read from this class.
|
|
570
410
|
* Even if this returns false, the user may still be able to access it if
|
|
@@ -574,36 +414,23 @@ class ParseCLP {
|
|
|
574
414
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
|
|
575
415
|
* @returns {boolean}
|
|
576
416
|
*/
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
getReadAccess(userId
|
|
580
|
-
/*: Entity*/
|
|
581
|
-
)
|
|
582
|
-
/*: boolean*/
|
|
583
|
-
{
|
|
417
|
+
getReadAccess(userId /*: Entity*/) /*: boolean*/{
|
|
584
418
|
return this._getAccess('find', userId) && this._getAccess('get', userId) && this._getAccess('count', userId);
|
|
585
419
|
}
|
|
420
|
+
|
|
586
421
|
/**
|
|
587
422
|
* Sets whether the given user id is allowed to write to this class.
|
|
588
423
|
*
|
|
589
424
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role..
|
|
590
425
|
* @param {boolean} allowed Whether that user should have write access.
|
|
591
426
|
*/
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
setWriteAccess(userId
|
|
595
|
-
/*: Entity*/
|
|
596
|
-
, allowed
|
|
597
|
-
/*: boolean*/
|
|
598
|
-
) {
|
|
427
|
+
setWriteAccess(userId /*: Entity*/, allowed /*: boolean*/) {
|
|
599
428
|
this._setAccess('create', userId, allowed);
|
|
600
|
-
|
|
601
429
|
this._setAccess('update', userId, allowed);
|
|
602
|
-
|
|
603
430
|
this._setAccess('delete', userId, allowed);
|
|
604
|
-
|
|
605
431
|
this._setAccess('addField', userId, allowed);
|
|
606
432
|
}
|
|
433
|
+
|
|
607
434
|
/**
|
|
608
435
|
* Gets whether the given user id is *explicitly* allowed to write to this class.
|
|
609
436
|
* Even if this returns false, the user may still be able to write it if
|
|
@@ -613,87 +440,64 @@ class ParseCLP {
|
|
|
613
440
|
* @param userId An instance of Parse.User or its objectId, or a Parse.Role.
|
|
614
441
|
* @returns {boolean}
|
|
615
442
|
*/
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
getWriteAccess(userId
|
|
619
|
-
/*: Entity*/
|
|
620
|
-
)
|
|
621
|
-
/*: boolean*/
|
|
622
|
-
{
|
|
443
|
+
getWriteAccess(userId /*: Entity*/) /*: boolean*/{
|
|
623
444
|
return this._getAccess('create', userId) && this._getAccess('update', userId) && this._getAccess('delete', userId) && this._getAccess('addField', userId);
|
|
624
445
|
}
|
|
446
|
+
|
|
625
447
|
/**
|
|
626
448
|
* Sets whether the public is allowed to read from this class.
|
|
627
449
|
*
|
|
628
450
|
* @param {boolean} allowed
|
|
629
451
|
*/
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
setPublicReadAccess(allowed
|
|
633
|
-
/*: boolean*/
|
|
634
|
-
) {
|
|
452
|
+
setPublicReadAccess(allowed /*: boolean*/) {
|
|
635
453
|
this.setReadAccess(PUBLIC_KEY, allowed);
|
|
636
454
|
}
|
|
455
|
+
|
|
637
456
|
/**
|
|
638
457
|
* Gets whether the public is allowed to read from this class.
|
|
639
458
|
*
|
|
640
459
|
* @returns {boolean}
|
|
641
460
|
*/
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
getPublicReadAccess()
|
|
645
|
-
/*: boolean*/
|
|
646
|
-
{
|
|
461
|
+
getPublicReadAccess() /*: boolean*/{
|
|
647
462
|
return this.getReadAccess(PUBLIC_KEY);
|
|
648
463
|
}
|
|
464
|
+
|
|
649
465
|
/**
|
|
650
466
|
* Sets whether the public is allowed to write to this class.
|
|
651
467
|
*
|
|
652
468
|
* @param {boolean} allowed
|
|
653
469
|
*/
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
setPublicWriteAccess(allowed
|
|
657
|
-
/*: boolean*/
|
|
658
|
-
) {
|
|
470
|
+
setPublicWriteAccess(allowed /*: boolean*/) {
|
|
659
471
|
this.setWriteAccess(PUBLIC_KEY, allowed);
|
|
660
472
|
}
|
|
473
|
+
|
|
661
474
|
/**
|
|
662
475
|
* Gets whether the public is allowed to write to this class.
|
|
663
476
|
*
|
|
664
477
|
* @returns {boolean}
|
|
665
478
|
*/
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
getPublicWriteAccess()
|
|
669
|
-
/*: boolean*/
|
|
670
|
-
{
|
|
479
|
+
getPublicWriteAccess() /*: boolean*/{
|
|
671
480
|
return this.getWriteAccess(PUBLIC_KEY);
|
|
672
481
|
}
|
|
482
|
+
|
|
673
483
|
/**
|
|
674
484
|
* Sets whether the public is allowed to protect fields in this class.
|
|
675
485
|
*
|
|
676
486
|
* @param {string[]} fields
|
|
677
487
|
*/
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
setPublicProtectedFields(fields
|
|
681
|
-
/*: string[]*/
|
|
682
|
-
) {
|
|
488
|
+
setPublicProtectedFields(fields /*: string[]*/) {
|
|
683
489
|
this.setProtectedFields(PUBLIC_KEY, fields);
|
|
684
490
|
}
|
|
491
|
+
|
|
685
492
|
/**
|
|
686
493
|
* Gets whether the public is allowed to read fields from this class.
|
|
687
494
|
*
|
|
688
495
|
* @returns {string[]}
|
|
689
496
|
*/
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
getPublicProtectedFields()
|
|
693
|
-
/*: string[]*/
|
|
694
|
-
{
|
|
497
|
+
getPublicProtectedFields() /*: string[]*/{
|
|
695
498
|
return this.getProtectedFields(PUBLIC_KEY);
|
|
696
499
|
}
|
|
500
|
+
|
|
697
501
|
/**
|
|
698
502
|
* Gets whether users belonging to the given role are allowed
|
|
699
503
|
* to read from this class. Even if this returns false, the role may
|
|
@@ -703,15 +507,10 @@ class ParseCLP {
|
|
|
703
507
|
* @returns {boolean} true if the role has read access. false otherwise.
|
|
704
508
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
705
509
|
*/
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
getRoleReadAccess(role
|
|
709
|
-
/*: ParseRole | string*/
|
|
710
|
-
)
|
|
711
|
-
/*: boolean*/
|
|
712
|
-
{
|
|
510
|
+
getRoleReadAccess(role /*: ParseRole | string*/) /*: boolean*/{
|
|
713
511
|
return this.getReadAccess(this._getRoleName(role));
|
|
714
512
|
}
|
|
513
|
+
|
|
715
514
|
/**
|
|
716
515
|
* Gets whether users belonging to the given role are allowed
|
|
717
516
|
* to write to this user. Even if this returns false, the role may
|
|
@@ -721,15 +520,10 @@ class ParseCLP {
|
|
|
721
520
|
* @returns {boolean} true if the role has write access. false otherwise.
|
|
722
521
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
723
522
|
*/
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
getRoleWriteAccess(role
|
|
727
|
-
/*: ParseRole | string*/
|
|
728
|
-
)
|
|
729
|
-
/*: boolean*/
|
|
730
|
-
{
|
|
523
|
+
getRoleWriteAccess(role /*: ParseRole | string*/) /*: boolean*/{
|
|
731
524
|
return this.getWriteAccess(this._getRoleName(role));
|
|
732
525
|
}
|
|
526
|
+
|
|
733
527
|
/**
|
|
734
528
|
* Sets whether users belonging to the given role are allowed
|
|
735
529
|
* to read from this class.
|
|
@@ -738,15 +532,10 @@ class ParseCLP {
|
|
|
738
532
|
* @param {boolean} allowed Whether the given role can read this object.
|
|
739
533
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
740
534
|
*/
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
setRoleReadAccess(role
|
|
744
|
-
/*: ParseRole | string*/
|
|
745
|
-
, allowed
|
|
746
|
-
/*: boolean*/
|
|
747
|
-
) {
|
|
535
|
+
setRoleReadAccess(role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
748
536
|
this.setReadAccess(this._getRoleName(role), allowed);
|
|
749
537
|
}
|
|
538
|
+
|
|
750
539
|
/**
|
|
751
540
|
* Sets whether users belonging to the given role are allowed
|
|
752
541
|
* to write to this class.
|
|
@@ -755,15 +544,10 @@ class ParseCLP {
|
|
|
755
544
|
* @param {boolean} allowed Whether the given role can write this object.
|
|
756
545
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
757
546
|
*/
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
setRoleWriteAccess(role
|
|
761
|
-
/*: ParseRole | string*/
|
|
762
|
-
, allowed
|
|
763
|
-
/*: boolean*/
|
|
764
|
-
) {
|
|
547
|
+
setRoleWriteAccess(role /*: ParseRole | string*/, allowed /*: boolean*/) {
|
|
765
548
|
this.setWriteAccess(this._getRoleName(role), allowed);
|
|
766
549
|
}
|
|
550
|
+
|
|
767
551
|
/**
|
|
768
552
|
* Gets whether users belonging to the given role are allowed
|
|
769
553
|
* to count to this user. Even if this returns false, the role may
|
|
@@ -773,15 +557,10 @@ class ParseCLP {
|
|
|
773
557
|
* @returns {string[]}
|
|
774
558
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
775
559
|
*/
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
getRoleProtectedFields(role
|
|
779
|
-
/*: ParseRole | string*/
|
|
780
|
-
)
|
|
781
|
-
/*: string[]*/
|
|
782
|
-
{
|
|
560
|
+
getRoleProtectedFields(role /*: ParseRole | string*/) /*: string[]*/{
|
|
783
561
|
return this.getProtectedFields(this._getRoleName(role));
|
|
784
562
|
}
|
|
563
|
+
|
|
785
564
|
/**
|
|
786
565
|
* Sets whether users belonging to the given role are allowed
|
|
787
566
|
* to set access field in this class.
|
|
@@ -790,17 +569,9 @@ class ParseCLP {
|
|
|
790
569
|
* @param {string[]} fields Fields to be protected by Role.
|
|
791
570
|
* @throws {TypeError} If role is neither a Parse.Role nor a String.
|
|
792
571
|
*/
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
setRoleProtectedFields(role
|
|
796
|
-
/*: ParseRole | string*/
|
|
797
|
-
, fields
|
|
798
|
-
/*: string[]*/
|
|
799
|
-
) {
|
|
572
|
+
setRoleProtectedFields(role /*: ParseRole | string*/, fields /*: string[]*/) {
|
|
800
573
|
this.setProtectedFields(this._getRoleName(role), fields);
|
|
801
574
|
}
|
|
802
|
-
|
|
803
575
|
}
|
|
804
|
-
|
|
805
576
|
var _default = ParseCLP;
|
|
806
577
|
exports.default = _default;
|