Skip to content

Commit

Permalink
fix: make isValidPrincipalId and extractRoleName instance methods again
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Kirkpatrick committed May 30, 2017
1 parent 495b017 commit f597abb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = class AccessUtils {

// Validate the format of options.groupRoles ($group:[role]).
this.options.groupRoles.forEach(name => {
if (!AccessUtils.isValidPrincipalId(name)) {
if (!this.isValidPrincipalId(name)) {
throw new Error('$name is an invalid access group name.')
}
})
Expand Down Expand Up @@ -253,7 +253,7 @@ module.exports = class AccessUtils {
* @param {String} principalId A principalId.
* @returns {Boolean} Returns true if the principalId is on the expected format.
*/
static isValidPrincipalId(principalId) {
isValidPrincipalId(principalId) {
return Boolean(this.extractRoleName(principalId))
}

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

Expand All @@ -281,7 +281,7 @@ module.exports = class AccessUtils {
const modelClass = context.model
const { modelId } = context
const userId = context.getUserId()
const roleName = AccessUtils.extractRoleName(role)
const roleName = this.extractRoleName(role)
const GroupAccess = this.app.models[this.options.groupAccessModel]
const scope = { }

Expand Down

0 comments on commit f597abb

Please sign in to comment.