| |
- UserKit.User.User
-
- RoleUser
class RoleUser(UserKit.User.User) |
|
RoleUser, in conjunction with Role, provides for role-based users and security.
See the doc for playsRole() for an example.
Note that this class plays nicely with both Role and HierRole. e.g., no "HierRoleUser" is needed when making use of HierRoles.
See also:
* class Role
* class HierRole |
|
Methods defined here:
- __init__(self, manager=None, name=None, password=None)
- addRoles(self, listOfRoles)
- Adds additional roles for the user. Each role in the list may be a valid role name or a Role object.
- playsRole(self, roleOrName)
- Returns 1 if the user plays the given role. More specifically, if any of the user's roles return true for role.playsRole(otherRole), this method returns true.
The application of this popular method often looks like this:
if user.playsRole('admin'):
displayAdminMenuItems()
- roles(self)
- Returns a direct list of the user's roles. Do not modify.
- setRoles(self, listOfRoles)
- Sets all the roles for the user. Each role in the list may be a valid role name or a Role object.
Implementation note: depends on addRoles().
Methods inherited from UserKit.User.User:
- creationTime(self)
- externalId(self)
- isActive(self)
- lastAccessTime(self)
- lastLoginTime(self)
- login(self, password, fromMgr=0)
- Return self if the login is successful and None otherwise.
- logout(self, fromMgr=0)
- manager(self)
- name(self)
- password(self)
- serialNum(self)
- setManager(self, manager)
- Set the manager, which can only be done once.
- setName(self, name)
- Set the name, which can only be done once.
- setPassword(self, password)
- wasAccessed(self)
| |