de.esprit.netsuite.server.permission

## Class AbstractPermissionConfig

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.netsuite.server.permission.AbstractPermissionConfig

- All Implemented Interfaces:
    Clearable, Dumpable, PermissionConfig, java.io.Serializable
  Direct Known Subclasses:
    DefaultPermissionConfig, FilePermissionConfig

      public abstract class AbstractPermissionConfig
      extends DumpableObject
      implements PermissionConfig

  This class encapsulates the configuration of user and group access permissions stored in the server config file `ServerConfigFile.PERMISSION`. User and group permissions are defined in different lists whereas group permissions are only checked if a requested user permission was not found. Note that group permissions only take effect, if a `GroupMembershipResolver` instance was installed using `setGroupMemberResolver(GroupMembershipResolver)`.
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `accessibleObjectKey`
    `static java.lang.String` | `groupNameKey`
    `static java.lang.String` | `groupPermissionsTable`
    `static java.lang.String` | `permissionConfigType`
    `static java.lang.String` | `permissionKey`
    `static java.lang.String` | `userNameKey`
    `static java.lang.String` | `userPermissionsTable`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractPermissionConfig()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addGroupPermission(GroupPermissionEntry entry)`
    `boolean` | `addUserPermission(UserPermissionEntry entry)`
    `void` | `checkUserPermission(UserId userId, PermissionControlled obj, EspritPermission permission)` Same as `PermissionConfig.hasUserPermission(UserId, PermissionControlled, EspritPermission)` but throws an exception if the permission was not granted.
    `void` | `clear()` Clears both user and group permissions
    `void` | `clearGroupPermissions()`
    `void` | `clearUserPermissions()`
    `java.util.List<GroupPermissionEntry>` | `findGroupPermissionsFor(Group group)`
    `GroupPermissionEntry` | `findGroupPermissionsFor(Group group, PermissionDefinition permDef)`
    `java.util.List<UserPermissionEntry>` | `findUserPermissionsFor(UserId userId)`
    `UserPermissionEntry` | `findUserPermissionsFor(UserId userId, PermissionDefinition permDef)`
    `java.util.List<GroupPermissionEntry>` | `getGroupPermissions()`
    `java.util.List<UserPermissionEntry>` | `getUserPermissions()`
    `boolean` | `hasGroupPermission(Group group, PermissionControlled obj, EspritPermission permission)` Tells whether the given group has the given permission on the given object.
    `boolean` | `hasGroupPermission(Group group, PermissionDefinition obj, EspritPermission permission)` Tells whether the given group has the given permission on the given object.
    `boolean` | `hasUserPermission(UserId userId, PermissionControlled obj, EspritPermission permission)` Tells whether the given user has the given permission on the given object.
    `boolean` | `hasUserPermission(UserId userId, PermissionDefinition obj, EspritPermission permission)` Tells whether the given user has the given permission on the given object.
    `void` | `read(ApplicationContext ctx, java.io.File inputFile)`
    `int` | `removeGroupPermissionsFor(java.lang.String groupName)` Removes all permissions of this group
    `int` | `removeGroupPermissionsFor(java.lang.String groupName, PermissionDefinition obj)`
    `int` | `removeUserPermissionsFor(java.lang.String userName)` Removes all permissions of this user
    `int` | `removeUserPermissionsFor(java.lang.String userName, PermissionDefinition obj)` Removes all permissions of this user that were assigned to the given object
    `void` | `setGroupMemberResolver(GroupMembershipResolver groupResolver)` Installs an instance that can find out the according `Group` of a `UserId`.
    `boolean` | `setGroupPermissions(Group group, PermissionDefinition obj, EspritPermission... permissions)` Adds a new permission, whereas a `PermissionEntry` is created from the given arguments.
    `boolean` | `setUserPermissions(UserId userId, PermissionDefinition permDef, EspritPermission... permissions)` Adds a new permission, whereas a `PermissionEntry` is created from the given arguments.
    `DumpString` | `toDumpString(DumpString s)` This method allows subclasses to add values to the existing DumpString of the superclass.
    `ToString` | `toString(ToString s)` This method allows subclasses to add values to the existing ToString of the superclass.
    `void` | `write(ApplicationContext ctx, java.io.File outputFile)`

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

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, 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.common.type.Dumpable

      `toDumpString, toString`

- - ### Field Detail

    - #### permissionConfigType

          public static final java.lang.String permissionConfigType

      See Also:
        Constant Field Values

    - #### userPermissionsTable

          public static final java.lang.String userPermissionsTable

      See Also:
        Constant Field Values

    - #### groupPermissionsTable

          public static final java.lang.String groupPermissionsTable

      See Also:
        Constant Field Values

    - #### groupNameKey

          public static final java.lang.String groupNameKey

      See Also:
        Constant Field Values

    - #### userNameKey

          public static final java.lang.String userNameKey

      See Also:
        Constant Field Values

    - #### accessibleObjectKey

          public static final java.lang.String accessibleObjectKey

      See Also:
        Constant Field Values

    - #### permissionKey

          public static final java.lang.String permissionKey

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractPermissionConfig

          public AbstractPermissionConfig()

  - ### Method Detail

    - #### setGroupMemberResolver

          public final void setGroupMemberResolver(GroupMembershipResolver groupResolver)

      Installs an instance that can find out the according `Group` of a `UserId`. If this instance is not set, no check for group-permissions will take place.
      Specified by:
        `setGroupMemberResolver` in interface `PermissionConfig`

    - #### getUserPermissions

          public final java.util.List<UserPermissionEntry> getUserPermissions()

    - #### addUserPermission

          public final boolean addUserPermission(UserPermissionEntry entry)

    - #### setUserPermissions

          public final boolean setUserPermissions(UserId userId,
                                   PermissionDefinition permDef,
                                   EspritPermission... permissions)

      Description copied from interface: `PermissionConfig`
      Adds a new permission, whereas a `PermissionEntry` is created from the given arguments.
      Specified by:
        `setUserPermissions` in interface `PermissionConfig`

    - #### findUserPermissionsFor

          public final java.util.List<UserPermissionEntry> findUserPermissionsFor(UserId userId)

    - #### findUserPermissionsFor

          public final UserPermissionEntry findUserPermissionsFor(UserId userId,
                                                   PermissionDefinition permDef)

    - #### hasUserPermission

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

      Description copied from interface: `PermissionConfig`
      Tells whether the given user has the given permission on the given object.
      Specified by:
        `hasUserPermission` in interface `PermissionConfig`
      See Also:
        `PermissionConfig.checkUserPermission(UserId, PermissionControlled, EspritPermission)`

    - #### hasUserPermission

          public final boolean hasUserPermission(UserId userId,
                                  PermissionDefinition obj,
                                  EspritPermission permission)

      Description copied from interface: `PermissionConfig`
      Tells whether the given user has the given permission on the given object. Note that this method allows for a client side check of a permission.
      Specified by:
        `hasUserPermission` in interface `PermissionConfig`

    - #### checkUserPermission

          public final void checkUserPermission(UserId userId,
                                 PermissionControlled obj,
                                 EspritPermission permission)
                                         throws PermissionException

      Description copied from interface: `PermissionConfig`
      Same as `PermissionConfig.hasUserPermission(UserId, PermissionControlled, EspritPermission)` but throws an exception if the permission was not granted.
      Specified by:
        `checkUserPermission` in interface `PermissionConfig`
      Throws:
        `PermissionException`

    - #### removeUserPermissionsFor

          public final int removeUserPermissionsFor(java.lang.String userName,
                                     PermissionDefinition obj)

      Removes all permissions of this user that were assigned to the given object
      Returns:
        the number of permissions actually removed

    - #### removeUserPermissionsFor

          public final int removeUserPermissionsFor(java.lang.String userName)

      Removes all permissions of this user
      Returns:
        the number of permissions actually removed

    - #### clearUserPermissions

          public final void clearUserPermissions()

    - #### getGroupPermissions

          public final java.util.List<GroupPermissionEntry> getGroupPermissions()

    - #### addGroupPermission

          public final boolean addGroupPermission(GroupPermissionEntry entry)

    - #### setGroupPermissions

          public final boolean setGroupPermissions(Group group,
                                    PermissionDefinition obj,
                                    EspritPermission... permissions)

      Description copied from interface: `PermissionConfig`
      Adds a new permission, whereas a `PermissionEntry` is created from the given arguments.
      Specified by:
        `setGroupPermissions` in interface `PermissionConfig`

    - #### findGroupPermissionsFor

          public final java.util.List<GroupPermissionEntry> findGroupPermissionsFor(Group group)

    - #### findGroupPermissionsFor

          public final GroupPermissionEntry findGroupPermissionsFor(Group group,
                                                     PermissionDefinition permDef)

    - #### hasGroupPermission

          public final boolean hasGroupPermission(Group group,
                                   PermissionControlled obj,
                                   EspritPermission permission)

      Description copied from interface: `PermissionConfig`
      Tells whether the given group has the given permission on the given object.
      Specified by:
        `hasGroupPermission` in interface `PermissionConfig`

    - #### hasGroupPermission

          public final boolean hasGroupPermission(Group group,
                                   PermissionDefinition obj,
                                   EspritPermission permission)

      Description copied from interface: `PermissionConfig`
      Tells whether the given group has the given permission on the given object. Note that this method allows for a client side check of a permission.
      Specified by:
        `hasGroupPermission` in interface `PermissionConfig`

    - #### removeGroupPermissionsFor

          public final int removeGroupPermissionsFor(java.lang.String groupName,
                                      PermissionDefinition obj)

    - #### removeGroupPermissionsFor

          public final int removeGroupPermissionsFor(java.lang.String groupName)

      Removes all permissions of this group
      Returns:
        the number of permissions actually removed

    - #### clearGroupPermissions

          public final void clearGroupPermissions()

    - #### clear

          public final void clear()

      Clears both user and group permissions
      Specified by:
        `clear` in interface `Clearable`

    - #### read

          public final void read(ApplicationContext ctx,
                  java.io.File inputFile)
                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### write

          public final void write(ApplicationContext ctx,
                   java.io.File outputFile)
                           throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### toString

          public ToString toString(ToString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing ToString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toString` in interface `Dumpable`
      Overrides:
        `toString` in class `DumpableObject`

    - #### toDumpString

          public DumpString toDumpString(DumpString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing DumpString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toDumpString` in interface `Dumpable`
      Overrides:
        `toDumpString` in class `DumpableObject`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.