org.tigris.scarab.tools
Class SecurityAdminTool

java.lang.Object
  extended byorg.tigris.scarab.tools.SecurityAdminTool
All Implemented Interfaces:
org.apache.turbine.services.pull.ApplicationTool, java.io.Serializable

public class SecurityAdminTool
extends java.lang.Object
implements org.apache.turbine.services.pull.ApplicationTool, java.io.Serializable

This scope is an object that is made available as a global object within the system to allow access to methods dealing with security (users, roles, permissions, etc). This object must be thread safe as multiple requests may access it at the same time. The object is made available in the context as: $securityAdmin

The design goals of the Scarab*API is to enable a pull based methodology to be implemented.

Version:
$Id: SecurityAdminTool.java 10042 2006-04-11 11:28:39Z jorgeuriarte $
Author:
Douglas B. Robertson
See Also:
Serialized Form

Constructor Summary
SecurityAdminTool()
           
 
Method Summary
 java.util.List getActiveScarabModules()
          Gets a list of all Groups
 org.apache.fulcrum.security.entity.Group[] getGroups()
          Gets a list of all Groups
 java.util.List getNonMemberGroups(ScarabUser user)
          Gets a list of active Groups in which the user does not have a current role and has not already requested a role.
 java.util.List getNonRootRoles()
          Gets a list of all Roles.
 java.util.List getPendingGroupUserRoles(Module module)
           
 org.apache.fulcrum.security.entity.Permission getPermissionByName(java.lang.String name)
          Returns a Permission object retrieved by specifying the name of the permission.
 org.apache.fulcrum.security.entity.Permission[] getPermissions()
          Gets a list of all Permissions
 java.util.List getPermissionsAsStrings()
          Gets a list of all Permissions
 org.apache.fulcrum.security.entity.Role getRoleByName(java.lang.String name)
          Returns a Role object retrieved by specifying the name of the role.
 org.apache.fulcrum.security.entity.Role[] getRoles()
          Gets a list of all Roles.
 ScarabUser getUserByUsername(java.lang.String username)
          Returns a User object retrieved by specifying the username.
 boolean hasRequestedRole(ScarabUser user, org.apache.fulcrum.security.entity.Role role, org.apache.fulcrum.security.entity.Group group)
           
 void init(java.lang.Object data)
           
 void refresh()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityAdminTool

public SecurityAdminTool()
Method Detail

init

public void init(java.lang.Object data)
Specified by:
init in interface org.apache.turbine.services.pull.ApplicationTool

refresh

public void refresh()
Specified by:
refresh in interface org.apache.turbine.services.pull.ApplicationTool

getUserByUsername

public ScarabUser getUserByUsername(java.lang.String username)
                             throws java.lang.Exception
Returns a User object retrieved by specifying the username.

Parameters:
username - the username of the user to retrieve
Returns:
the specified user, if found, or null otherwise
Throws:
java.lang.Exception

getPermissionByName

public org.apache.fulcrum.security.entity.Permission getPermissionByName(java.lang.String name)
                                                                  throws java.lang.Exception
Returns a Permission object retrieved by specifying the name of the permission.

Parameters:
name - the name of the permission to retrieve
Returns:
the specified Permission, if found, or null otherwise
Throws:
java.lang.Exception

getRoleByName

public org.apache.fulcrum.security.entity.Role getRoleByName(java.lang.String name)
                                                      throws java.lang.Exception
Returns a Role object retrieved by specifying the name of the role.

Parameters:
name - the name of the role to retrieve
Returns:
the specified Role, if found, or null otherwise
Throws:
java.lang.Exception

getGroups

public org.apache.fulcrum.security.entity.Group[] getGroups()
                                                     throws java.lang.Exception
Gets a list of all Groups

Throws:
java.lang.Exception

getActiveScarabModules

public java.util.List getActiveScarabModules()
                                      throws java.lang.Exception
Gets a list of all Groups

Throws:
java.lang.Exception

getNonMemberGroups

public java.util.List getNonMemberGroups(ScarabUser user)
                                  throws java.lang.Exception
Gets a list of active Groups in which the user does not have a current role and has not already requested a role.

Throws:
java.lang.Exception

hasRequestedRole

public boolean hasRequestedRole(ScarabUser user,
                                org.apache.fulcrum.security.entity.Role role,
                                org.apache.fulcrum.security.entity.Group group)
                         throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException

getPermissions

public org.apache.fulcrum.security.entity.Permission[] getPermissions()
                                                               throws java.lang.Exception
Gets a list of all Permissions

Throws:
java.lang.Exception

getPermissionsAsStrings

public java.util.List getPermissionsAsStrings()
                                       throws java.lang.Exception
Gets a list of all Permissions

Throws:
java.lang.Exception

getRoles

public org.apache.fulcrum.security.entity.Role[] getRoles()
                                                   throws java.lang.Exception
Gets a list of all Roles.

Throws:
java.lang.Exception

getNonRootRoles

public java.util.List getNonRootRoles()
                               throws java.lang.Exception
Gets a list of all Roles.

Throws:
java.lang.Exception

getPendingGroupUserRoles

public java.util.List getPendingGroupUserRoles(Module module)
                                        throws org.apache.torque.TorqueException
Throws:
org.apache.torque.TorqueException


Copyright © 2000-2004 Tigris.org. All Rights Reserved.