org.benow.security.user
Interface User

All Superinterfaces:
PermissionCheckable, java.security.Principal

public interface User
extends java.security.Principal, PermissionCheckable


Method Summary
 void addPermission(Permission p)
           
 void addRole(Role role)
           
 void addUserModule(UserModule module)
           
 void checkPermission(java.lang.Class<?> holderClass, java.lang.String name)
          Checks a named permission from a given class Convenience method for checkPermission(holderClass.getName()+"."+name);
 void checkPermission(Permission perm)
          checks to see if this role has the given permission.
 void checkPermission(java.lang.String name)
          Creates a default permission with the given name and checks for it's existence.
 void checkPermission(java.lang.String name, java.lang.String params)
          Creates a default permission with the given name and params and checks for it's existence.
 void checkRole(Role role)
           
 java.lang.String getDescription()
           
 java.lang.String getEmail()
           
 UserModule getModuleByClass(java.lang.Class<?> moduleClass)
          gets module of given class, if module does not exist is created.
 java.lang.String getName()
           
 java.lang.String getPassword()
          optionally implemented
 java.util.Collection<Permission> getPermissions()
          Gets permissions directly associated with the user.
 java.util.Collection<Role> getRoles()
           
 boolean hasModuleByClass(java.lang.Class<?> moduleClass)
           
 boolean hasPermission(Permission perm)
          Checks to see if the given permission has been granted.
 boolean hasPermission(java.lang.String name)
          Creates a new permission of the given name and returns it's existence.
 boolean hasPermission(java.lang.String name, java.lang.String params)
          Creates a new permission of the given name and params and returns it's existence.
 boolean hasRole(Role role)
           
 boolean hasRole(java.lang.String roleName)
           
 void init()
          Initialize the user after create
 boolean isConfirmed()
           
 void removePermission(Permission p)
           
 void removeRole(Role role)
           
 void setDescription(java.lang.String desc)
           
 void setEmail(java.lang.String email)
           
 void setName(java.lang.String string)
          Sets the user name.
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 
Methods inherited from interface org.benow.security.permission.PermissionCheckable
hasPermission
 

Method Detail

checkRole

void checkRole(Role role)
               throws java.lang.SecurityException
Throws:
java.lang.SecurityException

checkPermission

void checkPermission(Permission perm)
                     throws java.lang.SecurityException
Description copied from interface: PermissionCheckable
checks to see if this role has the given permission.

Specified by:
checkPermission in interface PermissionCheckable
Throws:
java.lang.SecurityException - if not

checkPermission

void checkPermission(java.lang.String name)
                     throws java.lang.SecurityException
Description copied from interface: PermissionCheckable
Creates a default permission with the given name and checks for it's existence.

Specified by:
checkPermission in interface PermissionCheckable
Throws:
java.lang.SecurityException - on permission check fail
See Also:
PermissionCheckable.checkPermission(Permission)

checkPermission

void checkPermission(java.lang.String name,
                     java.lang.String params)
                     throws java.lang.SecurityException
Description copied from interface: PermissionCheckable
Creates a default permission with the given name and params and checks for it's existence.

Specified by:
checkPermission in interface PermissionCheckable
Throws:
java.lang.SecurityException - on permission check fail
See Also:
PermissionCheckable.checkPermission(Permission)

hasRole

boolean hasRole(java.lang.String roleName)

hasRole

boolean hasRole(Role role)

hasPermission

boolean hasPermission(java.lang.String name)
Description copied from interface: PermissionCheckable
Creates a new permission of the given name and returns it's existence.

Specified by:
hasPermission in interface PermissionCheckable
Returns:
true if permission granted, false otherwise
See Also:
PermissionCheckable.hasPermission(Permission)

hasPermission

boolean hasPermission(java.lang.String name,
                      java.lang.String params)
Description copied from interface: PermissionCheckable
Creates a new permission of the given name and params and returns it's existence.

Specified by:
hasPermission in interface PermissionCheckable
Returns:
true if permission granted, false otherwise
See Also:
PermissionCheckable.hasPermission(Permission)

hasPermission

boolean hasPermission(Permission perm)
Description copied from interface: PermissionCheckable
Checks to see if the given permission has been granted.

Specified by:
hasPermission in interface PermissionCheckable
Returns:
true if permission granted, false otherwise
See Also:
PermissionCheckable.hasPermission(Permission)

getName

java.lang.String getName()
Specified by:
getName in interface java.security.Principal

isConfirmed

boolean isConfirmed()

getDescription

java.lang.String getDescription()

setDescription

void setDescription(java.lang.String desc)

getPassword

java.lang.String getPassword()
optionally implemented

Returns:
password

hasModuleByClass

boolean hasModuleByClass(java.lang.Class<?> moduleClass)

getModuleByClass

UserModule getModuleByClass(java.lang.Class<?> moduleClass)
                            throws NoSuchModuleException
gets module of given class, if module does not exist is created. If you need to know if a module exists currently call hasModuleByClass(Class) before this method.

Parameters:
moduleClass -
Returns:
Throws:
NoSuchModuleException

addUserModule

void addUserModule(UserModule module)

setName

void setName(java.lang.String string)
Sets the user name. Use with caution.

Parameters:
string -

setEmail

void setEmail(java.lang.String email)

getEmail

java.lang.String getEmail()

getRoles

java.util.Collection<Role> getRoles()

removeRole

void removeRole(Role role)

addRole

void addRole(Role role)

addPermission

void addPermission(Permission p)

removePermission

void removePermission(Permission p)

getPermissions

java.util.Collection<Permission> getPermissions()
Gets permissions directly associated with the user. Directly associated permissions are permissions that are individually assigned to a user, and not part of a role... in such a way the permissions can be assigned with fine granularity, not requiring per-user role creation.

Returns:
permissions associated with the user

checkPermission

void checkPermission(java.lang.Class<?> holderClass,
                     java.lang.String name)
Checks a named permission from a given class Convenience method for checkPermission(holderClass.getName()+"."+name);

Parameters:
holderClass -
name -

init

void init()
Initialize the user after create