Add a stub to register role resolvers

This commit is contained in:
Raymond Feng 2013-11-13 10:29:33 -08:00
parent 660ef89755
commit be32341467
1 changed files with 11 additions and 0 deletions

View File

@ -137,6 +137,17 @@ Role.RELATED = "$related"; // any User with a relationship to the object
Role.AUTHENTICATED = "$authenticated"; // authenticated user Role.AUTHENTICATED = "$authenticated"; // authenticated user
Role.EVERYONE = "$everyone"; // everyone 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 * Check if a given principal is in the role
* *