de.esprit.netsuite.server.permission

## Class DefaultPermissionManager<S extends ServerContext>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<S>
    - - de.esprit.netsuite.server.AbstractServerObject<S>
      - - de.esprit.netsuite.server.AbstractInitializableServerObject<S>
        - - de.esprit.netsuite.server.permission.DefaultPermissionManager<S>

- All Implemented Interfaces:
    ApplicationObject<S>, Initializable, SimpleLogSupport, Dumpable, PermissionControlled, PermissionManager<S>, ServerObject<S>

      public class DefaultPermissionManager<S extends ServerContext>
      extends AbstractInitializableServerObject<S>
      implements PermissionManager<S>

  This class manages permissions for user and group access control in the esprit server.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultPermissionManager(S serverCtx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addToPermissionControl(PermissionControlled instance)` Puts the given instance under permission control and stores the `PermissionDefinition` of this object.
    `void` | `checkPermission(SessionId sessionId, PermissionControlled obj, EspritPermission permission)` Checks whether the requested permission is granted to the given permission controlled object.
    `EspritPermission[]` | `getGroupPermissions(SessionId sessionId, Group group, PermissionDefinition obj)`
    `java.util.List<PermissionDefinition>` | `getPermissionControlledObjects()` Returns `PermissionDefinition`s of all `PermissionControlled` server objects.
    `PermissionDefinition` | `getPermissionDefinition()` Returns an object that identifies a `PermissionControlled` object with a unique name and provides a list of supported assignable permissions.
    `EspritPermission[]` | `getUserPermissions(SessionId sessionId, UserId userId, PermissionDefinition obj)`
    `boolean` | `hasPermission(UserId userId, PermissionControlled obj, EspritPermission permission)` Checks whether the user has been granted the given permission - not matter whether the permission was granted to the user explicitly or to any of his groups.
    `void` | `init()` Performs the initialization of this class.
    `void` | `removeGroupPermissionsFor(SessionId sessionId, Group group)`
    `void` | `removeGroupPermissionsFor(SessionId sessionId, Group group, PermissionDefinition obj)`
    `void` | `removeUserPermissionsFor(SessionId sessionId, UserId userId)` Removes all permission definitions of the given user
    `void` | `removeUserPermissionsFor(SessionId sessionId, UserId userId, PermissionDefinition obj)`
    `void` | `setGroupPermissions(SessionId sessionId, Group group, PermissionDefinition obj, EspritPermission... permissions)`
    `void` | `setUserPermissions(SessionId sessionId, UserId userId, PermissionDefinition obj, EspritPermission... permissions)` Sets the permissions of a user on a particular object

    - ### Methods inherited from class de.esprit.netsuite.server.AbstractInitializableServerObject

      `checkInitialized, isInitialized, setInitialized, toString`

    - ### Methods inherited from class de.esprit.netsuite.server.AbstractServerObject

      `checkPermission, getServerConfig, getServerContext, getStatisticManager`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString`

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

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

    - ### Methods inherited from interface de.esprit.netsuite.server.ServerObject

      `getServerContext`

- - ### Constructor Detail

    - #### DefaultPermissionManager

          public DefaultPermissionManager(S serverCtx)

  - ### Method Detail

    - #### init

          public void init()
                    throws java.lang.Exception

      Description copied from interface: `Initializable`
      Performs the initialization of this class. Note that the implementation should maintain an isInitialized flag which must be set when initialization has completed.
      Specified by:
        `init` in interface `Initializable`
      Specified by:
        `init` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### addToPermissionControl

          public final void addToPermissionControl(PermissionControlled instance)

      Description copied from interface: `PermissionManager`
      Puts the given instance under permission control and stores the `PermissionDefinition` of this object.
      Specified by:
        `addToPermissionControl` in interface `PermissionManager<S extends ServerContext>`

    - #### getPermissionControlledObjects

          public final java.util.List<PermissionDefinition> getPermissionControlledObjects()

      Description copied from interface: `PermissionManager`
      Returns `PermissionDefinition`s of all `PermissionControlled` server objects.
      Specified by:
        `getPermissionControlledObjects` in interface `PermissionManager<S extends ServerContext>`

    - #### getPermissionDefinition

          public final PermissionDefinition getPermissionDefinition()

      Description copied from interface: `PermissionControlled`
      Returns an object that identifies a `PermissionControlled` object with a unique name and provides a list of supported assignable permissions.
      Specified by:
        `getPermissionDefinition` in interface `PermissionControlled`

    - #### hasPermission

          public final boolean hasPermission(UserId userId,
                              PermissionControlled obj,
                              EspritPermission permission)

      Description copied from interface: `PermissionManager`
      Checks whether the user has been granted the given permission - not matter whether the permission was granted to the user explicitly or to any of his groups.
      Specified by:
        `hasPermission` in interface `PermissionManager<S extends ServerContext>`

    - #### checkPermission

          public final void checkPermission(SessionId sessionId,
                             PermissionControlled obj,
                             EspritPermission permission)
                                     throws PermissionException

      Description copied from interface: `PermissionManager`
      Checks whether the requested permission is granted to the given permission controlled object.
      Specified by:
        `checkPermission` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `PermissionException`

    - #### getUserPermissions

          public EspritPermission[] getUserPermissions(SessionId sessionId,
                                              UserId userId,
                                              PermissionDefinition obj)
                                                throws java.lang.Exception

      Specified by:
        `getUserPermissions` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### setUserPermissions

          public void setUserPermissions(SessionId sessionId,
                                UserId userId,
                                PermissionDefinition obj,
                                EspritPermission... permissions)
                                  throws java.lang.Exception

      Description copied from interface: `PermissionManager`
      Sets the permissions of a user on a particular object
      Specified by:
        `setUserPermissions` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### removeUserPermissionsFor

          public void removeUserPermissionsFor(SessionId sessionId,
                                      UserId userId,
                                      PermissionDefinition obj)
                                        throws java.lang.Exception

      Specified by:
        `removeUserPermissionsFor` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### removeUserPermissionsFor

          public void removeUserPermissionsFor(SessionId sessionId,
                                      UserId userId)
                                        throws java.lang.Exception

      Description copied from interface: `PermissionManager`
      Removes all permission definitions of the given user
      Specified by:
        `removeUserPermissionsFor` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### getGroupPermissions

          public EspritPermission[] getGroupPermissions(SessionId sessionId,
                                               Group group,
                                               PermissionDefinition obj)
                                                 throws java.lang.Exception

      Specified by:
        `getGroupPermissions` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### setGroupPermissions

          public void setGroupPermissions(SessionId sessionId,
                                 Group group,
                                 PermissionDefinition obj,
                                 EspritPermission... permissions)
                                   throws java.lang.Exception

      Specified by:
        `setGroupPermissions` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### removeGroupPermissionsFor

          public void removeGroupPermissionsFor(SessionId sessionId,
                                       Group group,
                                       PermissionDefinition obj)
                                         throws java.lang.Exception

      Specified by:
        `removeGroupPermissionsFor` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### removeGroupPermissionsFor

          public void removeGroupPermissionsFor(SessionId sessionId,
                                       Group group)
                                         throws java.lang.Exception

      Specified by:
        `removeGroupPermissionsFor` in interface `PermissionManager<S extends ServerContext>`
      Throws:
        `java.lang.Exception`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.