org.apache.felix.useradmin.impl
Class AuthorizationImpl

java.lang.Object
  extended by org.apache.felix.useradmin.impl.AuthorizationImpl
All Implemented Interfaces:
Authorization

public class AuthorizationImpl
extends Object
implements Authorization

Version:
$Rev$ $Date$
See Also:
Authorization

Constructor Summary
AuthorizationImpl(User user, UserAdminServiceImpl userAdmin)
          Construct new Authorization object with provided user and UserAdmin service implementation.
 
Method Summary
protected  void addWorkingOnRole(Role role)
          Adds working role to working on roles by this Autorization object.
 String getName()
          Gets the name of the User that this Authorization context was created for.
 String[] getRoles()
          Looking for all Roles implied by this Authorization object.
 boolean hasRole(String name)
          Checks if the role with the specified name is implied by this Authorization context.
protected  boolean isWorkingOnRole(Role role)
          Check if current Autorization object is working on provided role.
protected  void removeWorkingOnRole(Role role)
          Removes working on role.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorizationImpl

public AuthorizationImpl(User user,
                         UserAdminServiceImpl userAdmin)

Construct new Authorization object with provided user and UserAdmin service implementation.

Parameters:
user - User for who authorization can be checked
userAdmin - UserAdmin service implementation
Method Detail

getName

public String getName()
Description copied from interface: Authorization
Gets the name of the User that this Authorization context was created for.

Specified by:
getName in interface Authorization
Returns:
The name of the User object that this Authorization context was created for, or null if no user was specified when this Authorization context was created.
See Also:
Authorization.getName()

getRoles

public String[] getRoles()
Looking for all Roles implied by this Authorization object.

Specified by:
getRoles in interface Authorization
Returns:
The names of all roles implied by this Authorization context, or null if no roles are in the context. The predefined role user.anyone will not be included in this list.
See Also:
Authorization.getRoles()

hasRole

public boolean hasRole(String name)
Description copied from interface: Authorization
Checks if the role with the specified name is implied by this Authorization context.

Bundles must define globally unique role names that are associated with the privilege of accessing restricted resources or operations. Operators will grant users access to these resources, by creating a Group object for each role and adding User objects to it.

Specified by:
hasRole in interface Authorization
Parameters:
name - The name of the role to check for.
Returns:
true if this Authorization context implies the specified role, otherwise false.
See Also:
Authorization.hasRole(java.lang.String)

addWorkingOnRole

protected void addWorkingOnRole(Role role)
Adds working role to working on roles by this Autorization object.

Parameters:
role - to be added role.

removeWorkingOnRole

protected void removeWorkingOnRole(Role role)
Removes working on role.

Parameters:
role - to be removed from working by this Autorization object roles.

isWorkingOnRole

protected boolean isWorkingOnRole(Role role)
Check if current Autorization object is working on provided role. This check will avoid loop when Autorization is looking for imply roles.

Parameters:
role - Role on which Autorization object is working.
Returns:
true if this Autorization object is already working on provided role false if not.


Copyright © 2011 Apache Software Foundation. All Rights Reserved.