ca.bc.gov.webade.user
Class DefaultWebADEUserPermissions

java.lang.Object
  extended byca.bc.gov.webade.user.DefaultWebADEUserPermissions
All Implemented Interfaces:
java.io.Serializable, WebADEUserPermissions
Direct Known Subclasses:
DefaultWebADECurrentUserPermissions

public class DefaultWebADEUserPermissions
extends java.lang.Object
implements WebADEUserPermissions, java.io.Serializable

Author:
jross
See Also:
Serialized Form

Constructor Summary
DefaultWebADEUserPermissions(UserCredentials userCredentials, java.util.ArrayList nonSecuredByOrgRoles, java.util.HashMap rolesByOrg)
           
DefaultWebADEUserPermissions(UserCredentials userCredentials, java.util.HashMap rolesByOrg)
           
DefaultWebADEUserPermissions(WebADEUserPermissions permissions)
          Copy Constructor.
 
Method Summary
 boolean canPerformAction(Action action)
          Returns a boolean indicating whether a user is authorized to perform action.
 Organization[] getGovernmentOrganizations()
          Returns the Government Organizations a user has access to.
 Organization[] getNonGovernmentOrganizations()
          Returns the Non-Government Organizations a user has access to.
 Organization[] getOrganizations()
           
 Role[] getRoles()
           
 Role[] getRolesByOrganization(Organization targetOrg)
          Returns the set of roles assigned to the user by the given organization.
 Role[] getRolesNotSecuredByOrganization()
          Returns the set of roles assigned to the user that are not secured by organization.
 Organization getSelectedOrganization()
           
 UserCredentials getUserCredentials()
           
 boolean isUserInOrganization(Organization org)
          Returns a boolean indicating whether a user is authorized to act on behalf of an Organization.
 boolean isUserInRole(Role role)
          Returns a boolean indicating whether a user is authorized to act in the given role.
 void setSelectedOrganization(Organization selectedOrg)
          Sets the selected organization.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultWebADEUserPermissions

public DefaultWebADEUserPermissions(UserCredentials userCredentials,
                                    java.util.HashMap rolesByOrg)
Parameters:
userCredentials - The associated user credentials.
rolesByOrg - The authorized roles, organized by organization.

DefaultWebADEUserPermissions

public DefaultWebADEUserPermissions(UserCredentials userCredentials,
                                    java.util.ArrayList nonSecuredByOrgRoles,
                                    java.util.HashMap rolesByOrg)
Parameters:
userCredentials - The associated user credentials.
nonSecuredByOrgRoles - The authorized roles for this user that are not secured by organization.
rolesByOrg - The authorized roles, organized by organization.

DefaultWebADEUserPermissions

public DefaultWebADEUserPermissions(WebADEUserPermissions permissions)
Copy Constructor.

Parameters:
permissions - The permissions instance to copy.
Method Detail

getUserCredentials

public final UserCredentials getUserCredentials()
Specified by:
getUserCredentials in interface WebADEUserPermissions
Returns:
Returns the associated user's credentials.
See Also:
WebADEUserPermissions.getUserCredentials()

getOrganizations

public final Organization[] getOrganizations()
Specified by:
getOrganizations in interface WebADEUserPermissions
Returns:
Returns the orgs.
See Also:
WebADEUserPermissions.getOrganizations()

getRoles

public final Role[] getRoles()
Specified by:
getRoles in interface WebADEUserPermissions
Returns:
Returns the roles.
See Also:
WebADEUserPermissions.getRoles()

getRolesNotSecuredByOrganization

public Role[] getRolesNotSecuredByOrganization()
Description copied from interface: WebADEUserPermissions
Returns the set of roles assigned to the user that are not secured by organization.

Specified by:
getRolesNotSecuredByOrganization in interface WebADEUserPermissions
Returns:
Returns the nonsecured by organization roles assigned to the user.
See Also:
WebADEUserPermissions.getRolesNotSecuredByOrganization()

getRolesByOrganization

public final Role[] getRolesByOrganization(Organization targetOrg)
Description copied from interface: WebADEUserPermissions
Returns the set of roles assigned to the user by the given organization.

Specified by:
getRolesByOrganization in interface WebADEUserPermissions
Parameters:
targetOrg - The target organization.
Returns:
Returns the roles assigned to the user for that orgzniation.
See Also:
WebADEUserPermissions.getRolesByOrganization(ca.bc.gov.webade.Organization)

isUserInRole

public final boolean isUserInRole(Role role)
Description copied from interface: WebADEUserPermissions
Returns a boolean indicating whether a user is authorized to act in the given role.

Specified by:
isUserInRole in interface WebADEUserPermissions
Parameters:
role - the name of a role
Returns:
true if the user is authorized to act in the role
See Also:
WebADEUserPermissions.isUserInRole(ca.bc.gov.webade.Role)

canPerformAction

public final boolean canPerformAction(Action action)
Description copied from interface: WebADEUserPermissions
Returns a boolean indicating whether a user is authorized to perform action.

Specified by:
canPerformAction in interface WebADEUserPermissions
Parameters:
action - the target action
Returns:
true if the user is authorized to perform action
See Also:
WebADEUserPermissions.canPerformAction(ca.bc.gov.webade.Action)

getSelectedOrganization

public final Organization getSelectedOrganization()
Specified by:
getSelectedOrganization in interface WebADEUserPermissions
Returns:
Returns the selected organization.
See Also:
WebADEUserPermissions.getSelectedOrganization()

setSelectedOrganization

public final void setSelectedOrganization(Organization selectedOrg)
Description copied from interface: WebADEUserPermissions
Sets the selected organization.

Specified by:
setSelectedOrganization in interface WebADEUserPermissions
Parameters:
selectedOrg - The selected organization.
See Also:
WebADEUserPermissions.setSelectedOrganization(ca.bc.gov.webade.Organization)

getGovernmentOrganizations

public final Organization[] getGovernmentOrganizations()
Description copied from interface: WebADEUserPermissions
Returns the Government Organizations a user has access to.

Specified by:
getGovernmentOrganizations in interface WebADEUserPermissions
Returns:
The set of organizations this user is assigned to
See Also:
WebADEUserPermissions.getGovernmentOrganizations()

getNonGovernmentOrganizations

public final Organization[] getNonGovernmentOrganizations()
Description copied from interface: WebADEUserPermissions
Returns the Non-Government Organizations a user has access to.

Specified by:
getNonGovernmentOrganizations in interface WebADEUserPermissions
Returns:
The set of organizations this user is assigned to
See Also:
WebADEUserPermissions.getNonGovernmentOrganizations()

isUserInOrganization

public final boolean isUserInOrganization(Organization org)
Description copied from interface: WebADEUserPermissions
Returns a boolean indicating whether a user is authorized to act on behalf of an Organization.

Specified by:
isUserInOrganization in interface WebADEUserPermissions
Parameters:
org - the name of an organization
Returns:
true if the user is authorized access Org Unit
See Also:
WebADEUserPermissions.isUserInOrganization(ca.bc.gov.webade.Organization)

toString

public java.lang.String toString()
See Also:
Object.toString()