Package com.orchestranetworks.userservice.permission

# Interface ServicePermissionRule<S extends EntitySelection>

public interface ServicePermissionRule<S extends EntitySelection>
This interface can be implemented to specify the conditions under which a user service can be displayed and executed.

A class implementing this interface can be declared at two levels:

- as a global permission rule, when declared within the service declaration via API;
- as a data model local permission rule, when set in a schema extension; a local rule only applies in its data model assigned context.

For more information, see the Programmatic permission on service documentation.

Since:
  5.8.0
See Also:
  - Resolving permissions for services

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ServicePermissionRule<EntitySelection>`
  `ALWAYS_DISABLED`
  Always returns the disabled permission (i.e both for display and execution contexts).
  `static final ServicePermissionRule<EntitySelection>`
  `ALWAYS_ENABLED`
  Always returns the enabled permission (i.e for both display and execution contexts).
  `static final ServicePermissionRule<EntitySelection>`
  `ENABLED_FOR_EXECUTION_ONLY`
  Returns the disabled permission for display context, but returns enabled for execution.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `UserServicePermission`
  `getPermission(ServicePermissionRuleContext<S> aContext)`
  Returns a permission for the specified context.

- ## Field Details

  - ### ALWAYS_ENABLED

    static final ServicePermissionRule<EntitySelection> ALWAYS_ENABLED
    Always returns the enabled permission (i.e for both display and execution contexts).

  - ### ENABLED_FOR_EXECUTION_ONLY

    static final ServicePermissionRule<EntitySelection> ENABLED_FOR_EXECUTION_ONLY
    Returns the disabled permission for display context, but returns enabled for execution.

  - ### ALWAYS_DISABLED

    static final ServicePermissionRule<EntitySelection> ALWAYS_DISABLED
    Always returns the disabled permission (i.e both for display and execution contexts).

- ## Method Details

  - ### getPermission

    UserServicePermission getPermission(ServicePermissionRuleContext<S> aContext)
    Returns a permission for the specified context.

    This method is called to evaluate permissions in two cases:

    - on display of a button or a menu item launching the service;
    - on launch of the service.

    ##### Multi-threading

    This method can be called simultaneously by several threads.

    Parameters:
      `aContext` - the current context in which the permission has to be resolved.