diff --git a/lib/models/role.js b/lib/models/role.js index c9a7be37..5522340b 100644 --- a/lib/models/role.js +++ b/lib/models/role.js @@ -137,6 +137,17 @@ Role.RELATED = "$related"; // any User with a relationship to the object Role.AUTHENTICATED = "$authenticated"; // authenticated user Role.EVERYONE = "$everyone"; // everyone +/** + * Add custom handler for roles + * @param role + * @param resolver The resolver function decides if a principal is in the role dynamically + * + * isInRole(role, context, callback) + */ +Role.registerResolver = function(role, resolver) { + Role.resolvers[role] = resolver; +}; + /** * Check if a given principal is in the role *