Skip to content

Commit f597abb

Browse files
author
Tom Kirkpatrick
committed
fix: make isValidPrincipalId and extractRoleName instance methods again
1 parent 495b017 commit f597abb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = class AccessUtils {
2828

2929
// Validate the format of options.groupRoles ($group:[role]).
3030
this.options.groupRoles.forEach(name => {
31-
if (!AccessUtils.isValidPrincipalId(name)) {
31+
if (!this.isValidPrincipalId(name)) {
3232
throw new Error('$name is an invalid access group name.')
3333
}
3434
})
@@ -253,7 +253,7 @@ module.exports = class AccessUtils {
253253
* @param {String} principalId A principalId.
254254
* @returns {Boolean} Returns true if the principalId is on the expected format.
255255
*/
256-
static isValidPrincipalId(principalId) {
256+
isValidPrincipalId(principalId) {
257257
return Boolean(this.extractRoleName(principalId))
258258
}
259259

@@ -263,7 +263,7 @@ module.exports = class AccessUtils {
263263
* @param {String} principalId A principalId.
264264
* @returns {Boolean} Returns true if the principalId is on the expected format.
265265
*/
266-
static extractRoleName(principalId) {
266+
extractRoleName(principalId) {
267267
return principalId.split(':')[1]
268268
}
269269

@@ -281,7 +281,7 @@ module.exports = class AccessUtils {
281281
const modelClass = context.model
282282
const { modelId } = context
283283
const userId = context.getUserId()
284-
const roleName = AccessUtils.extractRoleName(role)
284+
const roleName = this.extractRoleName(role)
285285
const GroupAccess = this.app.models[this.options.groupAccessModel]
286286
const scope = { }
287287

0 commit comments

Comments
 (0)