Package com.orchestranetworks.service

# Interface SessionPermissions

public interface SessionPermissions
Defines a facade for checking the user's session permissions (access rights or actions) on dataspaces, snapshots, datasets, records, and nodes (tables, ...).

See Also:
  - `Session.getPermissions()`
  - `Repository.createSessionPermissionsForUser(UserReference)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AccessPermission`
  `getAdaptationAccessPermission(Adaptation aDataSetOrRecord)`
  Returns the current user's access rights on the specified dataset or record.
  `AccessPermission`
  `getGlobalPermissionToAdministration()`
  Returns whether the user has permission to access the Administration area in the user interface.
  `AccessPermission`
  `getGlobalPermissionToDataModel()`
  Returns whether the user has permission to access the Data Models area in the user interface.
  `AccessPermission`
  `getGlobalPermissionToDataServices()`
  Returns whether the user has permission to access the Data Services area in the user interface.
  `AccessPermission`
  `getGlobalPermissionToDataSpace()`
  Returns whether the user has permission to access the Dataspaces area in the user interface.
  `AccessPermission`
  `getGlobalPermissionToIde()`
  Returns whether the user has permission to access the IDE user interface.
  `AccessPermission`
  `getGlobalPermissionToWorkflowModel()`
  Returns whether the user has permission to access the Workflow Models area in the user interface.
  `AccessPermission`
  `getHomeAccessPermission(AdaptationHome aDataSpaceOrSnapshot)`
  Returns the current user's access rights on the dataspace or snapshot specified.
  `ActionPermission`
  `getHomeActionPermissionForService(ServiceKey serviceKey, AdaptationHome aDataSpaceOrSnapshot)`
  Returns the current user's permissions for executing the dataspace or snapshot service specified.
  `ActionPermission`
  `getHomeActionPermissionToChangeOwner(AdaptationHome aDataSpaceOrSnapshot)`
  Returns the current user's permissions for changing the owner of the dataspace or snapshot specified.
  `ActionPermission`
  `getHomeActionPermissionToChangePermission(AdaptationHome aDataSpaceOrSnapshot)`
  Returns the current user's permissions for changing permissions of the dataspace or snapshot specified.
  `ActionPermission`
  `getHomeActionPermissionToCloseHome(AdaptationHome aDataSpaceOrSnapshot)`
  Returns the current user's permissions for closing the dataspace or snapshot specified.
  `ActionPermission`
  `getHomeActionPermissionToCreateChildBranch(AdaptationHome aDataSpace)`
  Returns the current user's permissions for creating child dataspaces from the dataspace specified.
  `ActionPermission`
  `getHomeActionPermissionToCreateChildVersion(AdaptationHome aDataSpace)`
  Returns the current user's permissions for creating child snapshots from the dataspace specified.
  `ActionPermission`
  `getHomeActionPermissionToCreateRootInstance(AdaptationHome aDataSpaceOrSnapshot)`
  Returns the current user's permissions for creating a root dataset.
  `ActionPermission`
  `getHomeActionPermissionToExportArchive(AdaptationHome aDataSpaceOrSnapshot)`
  Returns the current user's permission for performing an archive export of the dataspace or snapshot specified.
  `ActionPermission`
  `getHomeActionPermissionToImportArchive(AdaptationHome aDataSpace)`
  Returns the current user's permissions for performing an archive import into the dataspace specified.
  `ActionPermission`
  `getHomeActionPermissionToInitializeMerge(AdaptationHome aDataSpace)`
  Returns the current user's permissions for merging the dataspace specified.
  `ActionPermission`
  `getHomeActionPermissionToLockHome(LockSpec aSpec, AdaptationHome aDataSpace)`
  Returns the current user's permissions for locking the dataspace specified.
  `ActionPermission`
  `getHomeActionPermissionToUnlockHome(LockSpec aSpec, AdaptationHome aDataSpace)`
  Returns the current user's permissions for unlocking the dataspace specified.
  `ActionPermission`
  `getInstanceActionPermissionForService(ServiceKey serviceKey, Adaptation aDataSet)`
  Returns the current user's permissions for executing the dataset service specified.
  `ActionPermission`
  `getInstanceActionPermissionToActivateInstance(Adaptation aDataSet)`
  Returns the current user's permissions for activating the dataset specified.
  `ActionPermission`
  `getInstanceActionPermissionToCreateChild(Adaptation aDataSet)`
  Returns the current user's permissions for creating child datasets from the dataset specified.
  `ActionPermission`
  `getInstanceActionPermissionToCreateDuplicate(Adaptation aDataSet)`
  Returns the current user's permissions for duplicating the dataset specified.
  `ActionPermission`
  `getInstanceActionPermissionToDeleteInstance(Adaptation aDataSet)`
  Returns the current user's permissions for deleting the dataset specified.
  `AccessPermission`
  `getNodeAccessPermission(SchemaNode aNode, Adaptation aDataSetOrRecord)`
  Returns the current user's access rights on the specified node in an update/display context.
  `AccessPermission`
  `getNodeAccessPermissionForCreate(SchemaNode aNode, AdaptationTable aTable)`
  Returns the current user's access rights on the specified node in a creation context.
  `AccessPermission`
  `getNodeAccessPermissionForForm(SchemaNode aNode, Adaptation aDataSetOrRecord)`
  Returns the current user's access rights on the specified node when displayed in a form.
  `ActionPermission`
  `getNodeActionPermissionForService(ServiceKey aServiceKey, SchemaNode aNode, Adaptation aDataSetOrRecord)`
  Returns the current user's permissions for executing the service on the specified node.
  `ActionPermission`
  `getOccurrenceActionPermissionToDelete(Adaptation aRecord, AdaptationTable aTable)`
  Returns the current user's permissions for deleting the specified table record.
  `ActionPermission`
  `getOccurrenceActionPermissionToOccult(Adaptation aRecord, AdaptationTable aTable)`
  Returns the current user's permissions for occulting the specified table record.
  `ActionPermission`
  `getOccurrenceActionPermissionToOverwrite(Adaptation aRecord, AdaptationTable aTable)`
  Returns the current user's permissions for overwriting the specified table record.
  `Session`
  `getSession()`
  Deprecated.
  Since 5.4.1, this method returns `null` if this instance has been created directly to evaluate user permissions.
  `ActionPermission`
  `getTableActionPermissionForService(ServiceKey serviceKey, AdaptationTable aTable)`
  Returns the current user's permissions for executing the service in the table specified.
  `ActionPermission`
  `getTableActionPermissionToCreateRootOccurrence(AdaptationTable aTable)`
  Returns the current user's permissions for creating a table record in the table specified.
  `boolean`
  `isHomeOwner(AdaptationHome aDataSpaceOrSnapshot)`
  Returns whether the current user is the owner of the dataspace or snapshot specified.

- ## Method Details

  - ### getGlobalPermissionToAdministration

    AccessPermission getGlobalPermissionToAdministration()
    Returns whether the user has permission to access the Administration area in the user interface.

  - ### getGlobalPermissionToDataSpace

    AccessPermission getGlobalPermissionToDataSpace()
    Returns whether the user has permission to access the Dataspaces area in the user interface.

  - ### getGlobalPermissionToDataModel

    AccessPermission getGlobalPermissionToDataModel()
    Returns whether the user has permission to access the Data Models area in the user interface.

  - ### getGlobalPermissionToWorkflowModel

    AccessPermission getGlobalPermissionToWorkflowModel()
    Returns whether the user has permission to access the Workflow Models area in the user interface.

  - ### getGlobalPermissionToDataServices

    AccessPermission getGlobalPermissionToDataServices()
    Returns whether the user has permission to access the Data Services area in the user interface.

  - ### getGlobalPermissionToIde

    AccessPermission getGlobalPermissionToIde()
    Returns whether the user has permission to access the IDE user interface.
    Since:
      6.2.0

  - ### getHomeAccessPermission

    AccessPermission getHomeAccessPermission(AdaptationHome aDataSpaceOrSnapshot)
    Returns the current user's access rights on the dataspace or snapshot specified.

  - ### getAdaptationAccessPermission

    AccessPermission getAdaptationAccessPermission(Adaptation aDataSetOrRecord)
    Returns the current user's access rights on the specified dataset or record.

  - ### getNodeAccessPermission

    AccessPermission getNodeAccessPermission(SchemaNode aNode, Adaptation aDataSetOrRecord)
    Returns the current user's access rights on the specified node in an update/display context.

    When the specified node is not terminal, the access permission returned by this method is `read-only` if at least one of its children is not `hidden`, returns `hidden` otherwise.

    Note: There can be additional permission rules applying while in a creation context, in this case `getNodeAccessPermissionForCreate(SchemaNode, AdaptationTable)` should be used instead.

  - ### getNodeAccessPermissionForCreate

    AccessPermission getNodeAccessPermissionForCreate(SchemaNode aNode, AdaptationTable aTable)
    Returns the current user's access rights on the specified node in a creation context.

    When the specified node is not terminal, the access permission returned by this method is `read-only` if at least one of its children is not `hidden`, returns `hidden` otherwise.

    Since:
      5.9.0

  - ### getNodeAccessPermissionForForm

    AccessPermission getNodeAccessPermissionForForm(SchemaNode aNode, Adaptation aDataSetOrRecord)
    Returns the current user's access rights on the specified node when displayed in a form.

    When the specified node is a table record node and the specified adaptation is a dataset, permissions are evaluated in the context of a record creation. In such a case, there can be some additional permission rules applying (see `AccessRuleForCreate`).

    The access permission returned by this method is never less restrictive than the one returned by getNodeAccessPermission(SchemaNode, Adaptation).

    Since:
      5.8.0

  - ### getNodeActionPermissionForService

    ActionPermission getNodeActionPermissionForService(ServiceKey aServiceKey, SchemaNode aNode, Adaptation aDataSetOrRecord)
    Returns the current user's permissions for executing the service on the specified node. If the specified service is not found, `ActionPermission.getDisabled()` is returned.
    Since:
      5.4.2

  - ### getHomeActionPermissionToCreateChildBranch

    ActionPermission getHomeActionPermissionToCreateChildBranch(AdaptationHome aDataSpace)
    Returns the current user's permissions for creating child dataspaces from the dataspace specified.

  - ### getHomeActionPermissionToCreateChildVersion

    ActionPermission getHomeActionPermissionToCreateChildVersion(AdaptationHome aDataSpace)
    Returns the current user's permissions for creating child snapshots from the dataspace specified.

  - ### getHomeActionPermissionToInitializeMerge

    ActionPermission getHomeActionPermissionToInitializeMerge(AdaptationHome aDataSpace)
    Returns the current user's permissions for merging the dataspace specified.

  - ### getHomeActionPermissionToExportArchive

    ActionPermission getHomeActionPermissionToExportArchive(AdaptationHome aDataSpaceOrSnapshot)
    Returns the current user's permission for performing an archive export of the dataspace or snapshot specified.

  - ### getHomeActionPermissionToImportArchive

    ActionPermission getHomeActionPermissionToImportArchive(AdaptationHome aDataSpace)
    Returns the current user's permissions for performing an archive import into the dataspace specified.

  - ### getHomeActionPermissionToCloseHome

    ActionPermission getHomeActionPermissionToCloseHome(AdaptationHome aDataSpaceOrSnapshot)
    Returns the current user's permissions for closing the dataspace or snapshot specified.

  - ### isHomeOwner

    boolean isHomeOwner(AdaptationHome aDataSpaceOrSnapshot)
    Returns whether the current user is the owner of the dataspace or snapshot specified.

  - ### getHomeActionPermissionToLockHome

    ActionPermission getHomeActionPermissionToLockHome(LockSpec aSpec, AdaptationHome aDataSpace)
    Returns the current user's permissions for locking the dataspace specified.
    See Also:
      - `LockSpec.lock(AdaptationHome, Session)`

  - ### getHomeActionPermissionToUnlockHome

    ActionPermission getHomeActionPermissionToUnlockHome(LockSpec aSpec, AdaptationHome aDataSpace)
    Returns the current user's permissions for unlocking the dataspace specified.
    See Also:
      - `LockSpec.unlock(AdaptationHome, Session)`

  - ### getHomeActionPermissionToCreateRootInstance

    ActionPermission getHomeActionPermissionToCreateRootInstance(AdaptationHome aDataSpaceOrSnapshot)
    Returns the current user's permissions for creating a root dataset.

  - ### getHomeActionPermissionToChangeOwner

    ActionPermission getHomeActionPermissionToChangeOwner(AdaptationHome aDataSpaceOrSnapshot)
    Returns the current user's permissions for changing the owner of the dataspace or snapshot specified.

  - ### getHomeActionPermissionToChangePermission

    ActionPermission getHomeActionPermissionToChangePermission(AdaptationHome aDataSpaceOrSnapshot)
    Returns the current user's permissions for changing permissions of the dataspace or snapshot specified.

  - ### getHomeActionPermissionForService

    ActionPermission getHomeActionPermissionForService(ServiceKey serviceKey, AdaptationHome aDataSpaceOrSnapshot)
    Returns the current user's permissions for executing the dataspace or snapshot service specified. If the specified service is not found, `ActionPermission.getDisabled()` is returned.

  - ### getInstanceActionPermissionToCreateChild

    ActionPermission getInstanceActionPermissionToCreateChild(Adaptation aDataSet)
    Returns the current user's permissions for creating child datasets from the dataset specified.

  - ### getInstanceActionPermissionToCreateDuplicate

    ActionPermission getInstanceActionPermissionToCreateDuplicate(Adaptation aDataSet)
    Returns the current user's permissions for duplicating the dataset specified.

  - ### getInstanceActionPermissionToDeleteInstance

    ActionPermission getInstanceActionPermissionToDeleteInstance(Adaptation aDataSet)
    Returns the current user's permissions for deleting the dataset specified.

  - ### getInstanceActionPermissionToActivateInstance

    ActionPermission getInstanceActionPermissionToActivateInstance(Adaptation aDataSet)
    Returns the current user's permissions for activating the dataset specified.

  - ### getInstanceActionPermissionForService

    ActionPermission getInstanceActionPermissionForService(ServiceKey serviceKey, Adaptation aDataSet)
    Returns the current user's permissions for executing the dataset service specified. If the specified service is not found, `ActionPermission.getDisabled()` is returned.

  - ### getTableActionPermissionToCreateRootOccurrence

    ActionPermission getTableActionPermissionToCreateRootOccurrence(AdaptationTable aTable)
    Returns the current user's permissions for creating a table record in the table specified.

    #### Warning

    Access right on the table node for the current session is ignored when calling this method. To perform this additional check, method `getNodeAccessPermission(SchemaNode, Adaptation)` should also be called on the table node.

  - ### getTableActionPermissionForService

    ActionPermission getTableActionPermissionForService(ServiceKey serviceKey, AdaptationTable aTable)
    Returns the current user's permissions for executing the service in the table specified. If the specified service is not found, `ActionPermission.getDisabled()` is returned.
    Since:
      5.4.2

  - ### getOccurrenceActionPermissionToOverwrite

    ActionPermission getOccurrenceActionPermissionToOverwrite(Adaptation aRecord, AdaptationTable aTable)
    Returns the current user's permissions for overwriting the specified table record.

    #### Warning

    Access right on the table node for the current session is ignored when calling this method. To perform this additional check, method `getNodeAccessPermission(SchemaNode, Adaptation)` should also be called on the table node.

    Throws:
      `IllegalArgumentException` - if `aRecord` is a dataset.

  - ### getOccurrenceActionPermissionToOccult

    ActionPermission getOccurrenceActionPermissionToOccult(Adaptation aRecord, AdaptationTable aTable)
    Returns the current user's permissions for occulting the specified table record.

    #### Warning

    Access right on the table node for the current session is ignored when calling this method. To perform this additional check, method `getNodeAccessPermission(SchemaNode, Adaptation)` should also be called on the table node.

    Throws:
      `IllegalArgumentException` - if `aRecord` is a dataset.

  - ### getOccurrenceActionPermissionToDelete

    ActionPermission getOccurrenceActionPermissionToDelete(Adaptation aRecord, AdaptationTable aTable)
    Returns the current user's permissions for deleting the specified table record.

    #### Warning

    Access right on the table node for the current session is ignored when calling this method. To perform this additional check, method `getNodeAccessPermission(SchemaNode, Adaptation)` should also be called on the table node.

    Throws:
      `IllegalArgumentException` - if `aRecord` is a dataset.

  - ### getSession

    @Deprecated Session getSession()
    Deprecated.
    Since 5.4.1, this method returns `null` if this instance has been created directly to evaluate user permissions.
    Returns the associated user session, or `null` if this instance has been created directly to evaluate user permissions.
    See Also:
      - `Repository.createSessionPermissionsForUser(UserReference)`