Skip to content

Commit b55e8e6

Browse files
committed
Updates to latest schema permissions syntax
1 parent 1e2af2c commit b55e8e6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spec/Schema.spec.js

+9
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,9 @@ describe('Class Level Permissions for requiredAuth', () => {
958958
},
959959
'update': {
960960
'requiresAuthentication': true
961+
},
962+
'create': {
963+
'*': true
961964
}
962965
});
963966
}).then((user) => {
@@ -990,6 +993,12 @@ describe('Class Level Permissions for requiredAuth', () => {
990993
},
991994
'update': {
992995
'requiresAuthentication': true
996+
},
997+
'create': {
998+
'*': true
999+
},
1000+
'get': {
1001+
'*': true
9931002
}
9941003
});
9951004
}).then((user) => {

src/Controllers/SchemaController.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ const roleRegex = /^role:.*/;
105105
// * permission
106106
const publicRegex = /^\*$/
107107

108-
const permissionKeyRegex = Object.freeze([userIdRegex, roleRegex, publicRegex]);
108+
const requireAuthenticationRegex = /^requiresAuthentication$/
109+
110+
const permissionKeyRegex = Object.freeze([userIdRegex, roleRegex, publicRegex, requireAuthenticationRegex]);
109111

110112
function verifyPermissionKey(key) {
111113
let result = permissionKeyRegex.reduce((isGood, regEx) => {

0 commit comments

Comments
 (0)