(key, userIdRegExp)
| 216 | ]); |
| 217 | |
| 218 | function validatePermissionKey(key, userIdRegExp) { |
| 219 | let matchesSome = false; |
| 220 | for (const regEx of clpFieldsRegex) { |
| 221 | if (key.match(regEx) !== null) { |
| 222 | matchesSome = true; |
| 223 | break; |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | // userId depends on startup options so it's dynamic |
| 228 | const valid = matchesSome || key.match(userIdRegExp) !== null; |
| 229 | if (!valid) { |
| 230 | throw new Parse.Error( |
| 231 | Parse.Error.INVALID_JSON, |
| 232 | `'${key}' is not a valid key for class level permissions` |
| 233 | ); |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | function validateProtectedFieldsKey(key, userIdRegExp) { |
| 238 | let matchesSome = false; |
no test coverage detected
searching dependent graphs…