org.apache.turbine.services.security

## Class TurbineSecurity

- java.lang.Object
- - org.apache.turbine.services.security.TurbineSecurity

-     public abstract class TurbineSecurity
      extends Object

  This is a Facade class for SecurityService. This class provides static methods that call related methods of the implementation of SecurityService used by the System, according to the settings in TurbineResources.

  Certain Roles that the Users may have in the system may are not related to any specific resource nor entity. They are assigned within a special group named 'global' that can be referenced in the code as `TurbineModelManager.GLOBAL_GROUP_NAME`.

  Version:
    $Id: TurbineSecurity.java 1706239 2015-10-01 13:18:35Z tv $
  Author:
    Rafal Krzewski, Henning P. Schmiedehausen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TurbineSecurity()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `accountExists(String userName)` Check whether a specified user's account exists.
    `static boolean` | `accountExists(User user)` Check whether a specified user's account exists.
    `static void` | `addGroup(org.apache.fulcrum.security.entity.Group group)` Creates a new group with specified attributes.
    `static void` | `addPermission(org.apache.fulcrum.security.entity.Permission permission)` Creates a new permission with specified attributes.
    `static void` | `addRole(org.apache.fulcrum.security.entity.Role role)` Creates a new role with specified attributes.
    `static void` | `addUser(User user, String password)` Creates new user account with specified attributes.
    `static void` | `changePassword(User user, String oldPassword, String newPassword)` Change the password for an User.
    `static org.apache.fulcrum.security.entity.Group` | `createGroup(String name)` Creates a new Group in the system.
    `static org.apache.fulcrum.security.entity.Permission` | `createPermission(String name)` Creates a new Permission in the system.
    `static org.apache.fulcrum.security.entity.Role` | `createRole(String name)` Creates a new Role in the system.
    `static void` | `forcePassword(User user, String password)` Forcibly sets new password for an User.
    `static org.apache.fulcrum.security.acl.AccessControlList` | `getACL(User user)` Constructs an AccessControlList for a specific user.
    `static org.apache.fulcrum.security.util.GroupSet` | `getAllGroups()` Retrieves all groups defined in the system.
    `static org.apache.fulcrum.security.util.PermissionSet` | `getAllPermissions()` Retrieves all permissions defined in the system.
    `static org.apache.fulcrum.security.util.RoleSet` | `getAllRoles()` Retrieves all roles defined in the system.
    `static User` | `getAnonymousUser()` Constructs an User object to represent an anonymous user of the application.
    `static User` | `getAuthenticatedUser(String username, String password)` Authenticates an user, and constructs an User object to represent him/her.
    `static org.apache.fulcrum.security.entity.Group` | `getGlobalGroup()` Provides a reference to the Group object that represents the global group.
    `static org.apache.fulcrum.security.entity.Group` | `getGroupById(int groupId)` Retrieve a Group object with specified Id.
    `static org.apache.fulcrum.security.entity.Group` | `getGroupByName(String groupName)` Retrieve a Group object with specified name.
    `static org.apache.fulcrum.security.entity.Group` | `getGroupInstance(String groupName)` Construct a blank Group object.
    `static org.apache.fulcrum.security.entity.Permission` | `getPermissionById(int permissionId)` Retrieve a Permission object with specified Id.
    `static org.apache.fulcrum.security.entity.Permission` | `getPermissionByName(String permissionName)` Retrieve a Permission object with specified name.
    `static org.apache.fulcrum.security.entity.Permission` | `getPermissionInstance(String permName)` Construct a blank Permission object.
    `static org.apache.fulcrum.security.util.PermissionSet` | `getPermissions(org.apache.fulcrum.security.entity.Role role)` Retrieves all permissions associated with a role.
    `static org.apache.fulcrum.security.entity.Role` | `getRoleById(int roleId)` Retrieve a Role object with specified Id.
    `static org.apache.fulcrum.security.entity.Role` | `getRoleByName(String roleName)` Retrieve a Role object with specified name.
    `static org.apache.fulcrum.security.entity.Role` | `getRoleInstance(String roleName)` Construct a blank Role object.
    `static SecurityService` | `getService()` Retrieves an implementation of SecurityService, base on the settings in TurbineResources.
    `static User` | `getUser(String username)` Constructs an User object to represent a registered user of the application.
    `static User` | `getUserInstance()` Construct a blank User object.
    `static UserManager` | `getUserManager()` Returns the configured UserManager.
    `static void` | `grant(org.apache.fulcrum.security.entity.Role role, org.apache.fulcrum.security.entity.Permission permission)` Grants a Role a Permission
    `static void` | `grant(User user, org.apache.fulcrum.security.entity.Group group, org.apache.fulcrum.security.entity.Role role)` Grant an User a Role in a Group.
    `static boolean` | `isAnonymousUser(User user)` Checks whether a passed user object matches the anonymous user pattern according to the configured service
    `static void` | `removeGroup(org.apache.fulcrum.security.entity.Group group)` Removes a Group from the system.
    `static void` | `removePermission(org.apache.fulcrum.security.entity.Permission permission)` Removes a Permission from the system.
    `static void` | `removeRole(org.apache.fulcrum.security.entity.Role role)` Removes a Role from the system.
    `static void` | `removeUser(User user)` Removes an user account from the system.
    `static void` | `renameGroup(org.apache.fulcrum.security.entity.Group group, String name)` Renames an existing Group.
    `static void` | `renamePermission(org.apache.fulcrum.security.entity.Permission permission, String name)` Renames an existing Permission.
    `static void` | `renameRole(org.apache.fulcrum.security.entity.Role role, String name)` Renames an existing Role.
    `static void` | `revoke(org.apache.fulcrum.security.entity.Role role, org.apache.fulcrum.security.entity.Permission permission)` Revokes a Permission from a Role.
    `static void` | `revoke(User user, org.apache.fulcrum.security.entity.Group group, org.apache.fulcrum.security.entity.Role role)` Revoke a Role in a Group from an User.
    `static void` | `revokeAll(org.apache.fulcrum.security.entity.Role role)` Revokes all permissions from a Role.
    `static void` | `revokeAll(User user)` Revokes all roles from an User.
    `static void` | `saveOnSessionUnbind(User user)` Saves User data when the session is unbound.
    `static void` | `saveUser(User user)` Saves User's data in the permanent storage.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TurbineSecurity

          public TurbineSecurity()

  - ### Method Detail

    - #### getService

          public static SecurityService getService()

      Retrieves an implementation of SecurityService, base on the settings in TurbineResources.
      Returns:
        an implementation of SecurityService.

    - #### getUserInstance

          public static User getUserInstance()
                                      throws org.apache.fulcrum.security.util.UnknownEntityException

      Construct a blank User object. This method calls getUserClass, and then creates a new object using the default constructor.
      Returns:
        an object implementing User interface.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the object could not be instantiated.

    - #### getUserManager

          public static UserManager getUserManager()

      Returns the configured UserManager.
      Returns:
        An UserManager object

    - #### accountExists

          public static boolean accountExists(User user)
                                       throws org.apache.fulcrum.security.util.DataBackendException

      Check whether a specified user's account exists. The login name is used for looking up the account.
      Parameters:
        `user` - The user to be checked.
      Returns:
        true if the specified account exists
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.

    - #### accountExists

          public static boolean accountExists(String userName)
                                       throws org.apache.fulcrum.security.util.DataBackendException

      Check whether a specified user's account exists. The login name is used for looking up the account.
      Parameters:
        `userName` - The name of the user to be checked.
      Returns:
        true if the specified account exists
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.

    - #### getAuthenticatedUser

          public static User getAuthenticatedUser(String username,
                                  String password)
                                           throws org.apache.fulcrum.security.util.DataBackendException,
                                                  org.apache.fulcrum.security.util.UnknownEntityException,
                                                  org.apache.fulcrum.security.util.PasswordMismatchException

      Authenticates an user, and constructs an User object to represent him/her.
      Parameters:
        `username` - The user name.
        `password` - The user password.
      Returns:
        An authenticated Turbine User.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if user account is not present.
        `org.apache.fulcrum.security.util.PasswordMismatchException` - if the supplied password was incorrect.

    - #### getUser

          public static User getUser(String username)
                              throws org.apache.fulcrum.security.util.DataBackendException,
                                     org.apache.fulcrum.security.util.UnknownEntityException

      Constructs an User object to represent a registered user of the application.
      Parameters:
        `username` - The user name.
      Returns:
        A Turbine User.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if user account is not present.

    - #### getAnonymousUser

          public static User getAnonymousUser()
                                       throws org.apache.fulcrum.security.util.UnknownEntityException

      Constructs an User object to represent an anonymous user of the application.
      Returns:
        An anonymous Turbine User.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the anonymous User object couldn't be constructed.

    - #### isAnonymousUser

          public static boolean isAnonymousUser(User user)

      Checks whether a passed user object matches the anonymous user pattern according to the configured service
      Parameters:
        `user` - A user object
      Returns:
        True if this is an anonymous user

    - #### saveUser

          public static void saveUser(User user)
                               throws org.apache.fulcrum.security.util.UnknownEntityException,
                                      org.apache.fulcrum.security.util.DataBackendException

      Saves User's data in the permanent storage. The user account is required to exist in the storage.
      Parameters:
        `user` - The User object to save.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the user's account does not exist in the database.
        `org.apache.fulcrum.security.util.DataBackendException` - if there is a problem accessing the storage.

    - #### saveOnSessionUnbind

          public static void saveOnSessionUnbind(User user)
                                          throws org.apache.fulcrum.security.util.UnknownEntityException,
                                                 org.apache.fulcrum.security.util.DataBackendException

      Saves User data when the session is unbound. The user account is required to exist in the storage. LastLogin, AccessCounter, persistent pull tools, and any data stored in the permData hashtable that is not mapped to a column will be saved.
      Parameters:
        `user` - the user in the session
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the user's account does not exist in the database.
        `org.apache.fulcrum.security.util.DataBackendException` - if there is a problem accessing the storage.

    - #### changePassword

          public static void changePassword(User user,
                            String oldPassword,
                            String newPassword)
                                     throws org.apache.fulcrum.security.util.PasswordMismatchException,
                                            org.apache.fulcrum.security.util.UnknownEntityException,
                                            org.apache.fulcrum.security.util.DataBackendException

      Change the password for an User.
      Parameters:
        `user` - an User to change password for.
        `oldPassword` - the current password supplied by the user.
        `newPassword` - the current password requested by the user.
      Throws:
        `org.apache.fulcrum.security.util.PasswordMismatchException` - if the supplied password was incorrect.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the user's record does not exist in the database.
        `org.apache.fulcrum.security.util.DataBackendException` - if there is a problem accessing the storage.

    - #### forcePassword

          public static void forcePassword(User user,
                           String password)
                                    throws org.apache.fulcrum.security.util.UnknownEntityException,
                                           org.apache.fulcrum.security.util.DataBackendException

      Forcibly sets new password for an User. This is supposed by the administrator to change the forgotten or compromised passwords. Certain implementations of this feature would require administrative level access to the authenticating server / program.
      Parameters:
        `user` - an User to change password for.
        `password` - the new password.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the user's record does not exist in the database.
        `org.apache.fulcrum.security.util.DataBackendException` - if there is a problem accessing the storage.

    - #### getACL

          public static org.apache.fulcrum.security.acl.AccessControlList getACL(User user)
                                                                          throws org.apache.fulcrum.security.util.DataBackendException,
                                                                                 org.apache.fulcrum.security.util.UnknownEntityException

      Constructs an AccessControlList for a specific user.
      Parameters:
        `user` - the user for whom the AccessControlList are to be retrieved
      Returns:
        The AccessControList object constructed from the user object.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if user account is not present.

    - #### grant

          public static void grant(User user,
                   org.apache.fulcrum.security.entity.Group group,
                   org.apache.fulcrum.security.entity.Role role)
                            throws org.apache.fulcrum.security.util.DataBackendException,
                                   org.apache.fulcrum.security.util.UnknownEntityException

      Grant an User a Role in a Group.
      Parameters:
        `user` - the user.
        `group` - the group.
        `role` - the role.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if user account, group or role is not present.

    - #### revoke

          public static void revoke(User user,
                    org.apache.fulcrum.security.entity.Group group,
                    org.apache.fulcrum.security.entity.Role role)
                             throws org.apache.fulcrum.security.util.DataBackendException,
                                    org.apache.fulcrum.security.util.UnknownEntityException

      Revoke a Role in a Group from an User.
      Parameters:
        `user` - the user.
        `group` - the group.
        `role` - the role.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if user account, group or role is not present.

    - #### revokeAll

          public static void revokeAll(User user)
                                throws org.apache.fulcrum.security.util.DataBackendException,
                                       org.apache.fulcrum.security.util.UnknownEntityException

      Revokes all roles from an User. This method is used when deleting an account.
      Parameters:
        `user` - the User.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the account is not present.

    - #### grant

          public static void grant(org.apache.fulcrum.security.entity.Role role,
                   org.apache.fulcrum.security.entity.Permission permission)
                            throws org.apache.fulcrum.security.util.DataBackendException,
                                   org.apache.fulcrum.security.util.UnknownEntityException

      Grants a Role a Permission
      Parameters:
        `role` - the Role.
        `permission` - the Permission.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if role or permission is not present.

    - #### revoke

          public static void revoke(org.apache.fulcrum.security.entity.Role role,
                    org.apache.fulcrum.security.entity.Permission permission)
                             throws org.apache.fulcrum.security.util.DataBackendException,
                                    org.apache.fulcrum.security.util.UnknownEntityException

      Revokes a Permission from a Role.
      Parameters:
        `role` - the Role.
        `permission` - the Permission.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if role or permission is not present.

    - #### revokeAll

          public static void revokeAll(org.apache.fulcrum.security.entity.Role role)
                                throws org.apache.fulcrum.security.util.DataBackendException,
                                       org.apache.fulcrum.security.util.UnknownEntityException

      Revokes all permissions from a Role. This method is user when deleting a Role.
      Parameters:
        `role` - the Role
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the Role is not present.

    - #### addUser

          public static void addUser(User user,
                     String password)
                              throws org.apache.fulcrum.security.util.DataBackendException,
                                     org.apache.fulcrum.security.util.EntityExistsException

      Creates new user account with specified attributes. TODO throw more specific exception
      Parameters:
        `user` - the object describing account to be created.
        `password` - password for the new user
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.EntityExistsException` - if the user account already exists.

    - #### removeUser

          public static void removeUser(User user)
                                 throws org.apache.fulcrum.security.util.DataBackendException,
                                        org.apache.fulcrum.security.util.UnknownEntityException

      Removes an user account from the system. TODO throw more specific exception
      Parameters:
        `user` - the object describing the account to be removed.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the user account is not present.

    - #### getGlobalGroup

          public static org.apache.fulcrum.security.entity.Group getGlobalGroup()

      Provides a reference to the Group object that represents the global group.
      Returns:
        a Group object that represents the global group.

    - #### createGroup

          public static org.apache.fulcrum.security.entity.Group createGroup(String name)
                                                                      throws org.apache.fulcrum.security.util.FulcrumSecurityException

      Creates a new Group in the system. This is a convenience method.
      Parameters:
        `name` - The name of the new Group.
      Returns:
        An object representing the new Group.
      Throws:
        `org.apache.fulcrum.security.util.FulcrumSecurityException` - if the Group could not be created.

    - #### createPermission

          public static org.apache.fulcrum.security.entity.Permission createPermission(String name)
                                                                                throws org.apache.fulcrum.security.util.FulcrumSecurityException

      Creates a new Permission in the system. This is a convenience method.
      Parameters:
        `name` - The name of the new Permission.
      Returns:
        An object representing the new Permission.
      Throws:
        `org.apache.fulcrum.security.util.FulcrumSecurityException` - if the Permission could not be created.

    - #### createRole

          public static org.apache.fulcrum.security.entity.Role createRole(String name)
                                                                    throws org.apache.fulcrum.security.util.FulcrumSecurityException

      Creates a new Role in the system. This is a convenience method.
      Parameters:
        `name` - The name of the Role.
      Returns:
        An object representing the new Role.
      Throws:
        `org.apache.fulcrum.security.util.FulcrumSecurityException` - if the Role could not be created.

    - #### getGroupByName

          public static org.apache.fulcrum.security.entity.Group getGroupByName(String groupName)
                                                                         throws org.apache.fulcrum.security.util.DataBackendException,
                                                                                org.apache.fulcrum.security.util.UnknownEntityException

      Retrieve a Group object with specified name.
      Parameters:
        `groupName` - The name of the Group to be retrieved.
      Returns:
        an object representing the Group with specified name.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the Group is not present.

    - #### getGroupById

          public static org.apache.fulcrum.security.entity.Group getGroupById(int groupId)
                                                                       throws org.apache.fulcrum.security.util.DataBackendException,
                                                                              org.apache.fulcrum.security.util.UnknownEntityException

      Retrieve a Group object with specified Id.
      Parameters:
        `groupId` - the id of the Group.
      Returns:
        an object representing the Group with specified name.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the permission does not exist in the database.
        `org.apache.fulcrum.security.util.DataBackendException` - if there is a problem accessing the storage.

    - #### getGroupInstance

          public static org.apache.fulcrum.security.entity.Group getGroupInstance(String groupName)
                                                                           throws org.apache.fulcrum.security.util.UnknownEntityException

      Construct a blank Group object. This method calls getGroupClass, and then creates a new object using the default constructor.
      Parameters:
        `groupName` - The name of the Group
      Returns:
        an object implementing Group interface.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the object could not be instantiated.

    - #### getRoleInstance

          public static org.apache.fulcrum.security.entity.Role getRoleInstance(String roleName)
                                                                         throws org.apache.fulcrum.security.util.UnknownEntityException

      Construct a blank Role object. This method calls getRoleClass, and then creates a new object using the default constructor.
      Parameters:
        `roleName` - The name of the role.
      Returns:
        an object implementing Role interface.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the object could not be instantiated.

    - #### getPermissionInstance

          public static org.apache.fulcrum.security.entity.Permission getPermissionInstance(String permName)
                                                                                     throws org.apache.fulcrum.security.util.UnknownEntityException

      Construct a blank Permission object. This method calls getPermissionClass, and then creates a new object using the default constructor.
      Parameters:
        `permName` - The name of the permission.
      Returns:
        an object implementing Permission interface.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the object could not be instantiated.

    - #### getRoleByName

          public static org.apache.fulcrum.security.entity.Role getRoleByName(String roleName)
                                                                       throws org.apache.fulcrum.security.util.DataBackendException,
                                                                              org.apache.fulcrum.security.util.UnknownEntityException

      Retrieve a Role object with specified name.
      Parameters:
        `roleName` - The name of the Role to be retrieved.
      Returns:
        an object representing the Role with specified name.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the Role is not present.

    - #### getRoleById

          public static org.apache.fulcrum.security.entity.Role getRoleById(int roleId)
                                                                     throws org.apache.fulcrum.security.util.DataBackendException,
                                                                            org.apache.fulcrum.security.util.UnknownEntityException

      Retrieve a Role object with specified Id.
      Parameters:
        `roleId` - the id of the Role.
      Returns:
        an object representing the Role with specified name.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the permission does not exist in the database.
        `org.apache.fulcrum.security.util.DataBackendException` - if there is a problem accessing the storage.

    - #### getPermissionByName

          public static org.apache.fulcrum.security.entity.Permission getPermissionByName(String permissionName)
                                                                                   throws org.apache.fulcrum.security.util.DataBackendException,
                                                                                          org.apache.fulcrum.security.util.UnknownEntityException

      Retrieve a Permission object with specified name.
      Parameters:
        `permissionName` - The name of the Permission to be retrieved.
      Returns:
        an object representing the Permission with specified name.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the Permission is not present.

    - #### getPermissionById

          public static org.apache.fulcrum.security.entity.Permission getPermissionById(int permissionId)
                                                                                 throws org.apache.fulcrum.security.util.DataBackendException,
                                                                                        org.apache.fulcrum.security.util.UnknownEntityException

      Retrieve a Permission object with specified Id.
      Parameters:
        `permissionId` - the id of the Permission.
      Returns:
        an object representing the Permission with specified name.
      Throws:
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the permission does not exist in the database.
        `org.apache.fulcrum.security.util.DataBackendException` - if there is a problem accessing the storage.

    - #### getAllGroups

          public static org.apache.fulcrum.security.util.GroupSet getAllGroups()
                                                                        throws org.apache.fulcrum.security.util.DataBackendException

      Retrieves all groups defined in the system.
      Returns:
        the names of all groups defined in the system.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.

    - #### getAllRoles

          public static org.apache.fulcrum.security.util.RoleSet getAllRoles()
                                                                      throws org.apache.fulcrum.security.util.DataBackendException

      Retrieves all roles defined in the system.
      Returns:
        the names of all roles defined in the system.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.

    - #### getAllPermissions

          public static org.apache.fulcrum.security.util.PermissionSet getAllPermissions()
                                                                                  throws org.apache.fulcrum.security.util.DataBackendException

      Retrieves all permissions defined in the system.
      Returns:
        the names of all roles defined in the system.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.

    - #### getPermissions

          public static org.apache.fulcrum.security.util.PermissionSet getPermissions(org.apache.fulcrum.security.entity.Role role)
                                                                               throws org.apache.fulcrum.security.util.DataBackendException,
                                                                                      org.apache.fulcrum.security.util.UnknownEntityException

      Retrieves all permissions associated with a role.
      Parameters:
        `role` - the role name, for which the permissions are to be retrieved.
      Returns:
        the Permissions for the specified role
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the role is not present.

    - #### addGroup

          public static void addGroup(org.apache.fulcrum.security.entity.Group group)
                               throws org.apache.fulcrum.security.util.DataBackendException,
                                      org.apache.fulcrum.security.util.EntityExistsException

      Creates a new group with specified attributes.
      Parameters:
        `group` - the object describing the group to be created.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.EntityExistsException` - if the group already exists.

    - #### addRole

          public static void addRole(org.apache.fulcrum.security.entity.Role role)
                              throws org.apache.fulcrum.security.util.DataBackendException,
                                     org.apache.fulcrum.security.util.EntityExistsException

      Creates a new role with specified attributes.
      Parameters:
        `role` - the objects describing the role to be created.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.EntityExistsException` - if the role already exists.

    - #### addPermission

          public static void addPermission(org.apache.fulcrum.security.entity.Permission permission)
                                    throws org.apache.fulcrum.security.util.DataBackendException,
                                           org.apache.fulcrum.security.util.EntityExistsException

      Creates a new permission with specified attributes.
      Parameters:
        `permission` - the objects describing the permission to be created.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.EntityExistsException` - if the permission already exists.

    - #### removeGroup

          public static void removeGroup(org.apache.fulcrum.security.entity.Group group)
                                  throws org.apache.fulcrum.security.util.DataBackendException,
                                         org.apache.fulcrum.security.util.UnknownEntityException

      Removes a Group from the system.
      Parameters:
        `group` - the object describing group to be removed.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the group does not exist.

    - #### removeRole

          public static void removeRole(org.apache.fulcrum.security.entity.Role role)
                                 throws org.apache.fulcrum.security.util.DataBackendException,
                                        org.apache.fulcrum.security.util.UnknownEntityException

      Removes a Role from the system.
      Parameters:
        `role` - The object describing the role to be removed.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the role does not exist.

    - #### removePermission

          public static void removePermission(org.apache.fulcrum.security.entity.Permission permission)
                                       throws org.apache.fulcrum.security.util.DataBackendException,
                                              org.apache.fulcrum.security.util.UnknownEntityException

      Removes a Permission from the system.
      Parameters:
        `permission` - The object describing the permission to be removed.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the permission does not exist.

    - #### renameGroup

          public static void renameGroup(org.apache.fulcrum.security.entity.Group group,
                         String name)
                                  throws org.apache.fulcrum.security.util.DataBackendException,
                                         org.apache.fulcrum.security.util.UnknownEntityException

      Renames an existing Group.
      Parameters:
        `group` - The object describing the group to be renamed.
        `name` - the new name for the group.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the group does not exist.

    - #### renameRole

          public static void renameRole(org.apache.fulcrum.security.entity.Role role,
                        String name)
                                 throws org.apache.fulcrum.security.util.DataBackendException,
                                        org.apache.fulcrum.security.util.UnknownEntityException

      Renames an existing Role.
      Parameters:
        `role` - The object describing the role to be renamed.
        `name` - the new name for the role.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the role does not exist.

    - #### renamePermission

          public static void renamePermission(org.apache.fulcrum.security.entity.Permission permission,
                              String name)
                                       throws org.apache.fulcrum.security.util.DataBackendException,
                                              org.apache.fulcrum.security.util.UnknownEntityException

      Renames an existing Permission.
      Parameters:
        `permission` - The object describing the permission to be renamed.
        `name` - the new name for the permission.
      Throws:
        `org.apache.fulcrum.security.util.DataBackendException` - if there was an error accessing the data backend.
        `org.apache.fulcrum.security.util.UnknownEntityException` - if the permission does not exist.

Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.