Package wt.access

Class AccessControlServerHelper

java.lang.Object
wt.access.AccessControlServerHelper
All Implemented Interfaces:
Externalizable, Serializable

public class AccessControlServerHelper extends Object implements Externalizable
Helper class that provides server invokable access control methods. It also provides easy access to the implementation of methods defined by the AccessControlManagerSvr interface.

Supported API: true

Extendable: false
See Also:
  • Field Details

  • Method Details

    • disableNotAuthorizedAudit

      public static void disableNotAuthorizedAudit()
      Disables auditing of the NotAuthorizedException. A MethodContext attribute is incremented to indicate that the exception should not be audited. When the attribute has a nonzero value, auditing is disabled.

      This method is to be used when the NotAuthorizedException does not result in a user's action failing due to the lack of access rights. For example, if the details page for a document includes information about its owner, and the accessResource.SECURED_INFORMATION message is displayed instead of the owner information when an attempt to access the owner results in a NotAuthorizedException, auditing should be disabled while attempting to get the owner information. Auditing must be re-enabled after the access attempt is complete. Uses of this API should be minimal. Consider calling one of the AccessControlManager access checking methods such as a hasAccess method and checking the result rather than catching a NotAuthorizedException.

      Code example:

       AccessControlServerHelper.disableNotAuthorizedAudit();
       try {
          // Perform an operation that may throw a NotAuthorizedException
          // nested in a WTRuntimeException
          ...
       }
       catch (WTRuntimeException wtre) {
          if (wtre.getNestedThrowable() instanceof NotAuthorizedException)
       {
             // Handle the authorization error that should not result in
             // the user's action failing
          }
          else {
             throw wtre;
          }
       }
       finally {
          AccessControlServerHelper.reenableNotAuthorizedAudit();
       }
       


      Supported API: true
    • isNotAuthorizedAuditEnabled

      public static boolean isNotAuthorizedAuditEnabled()
      Returns true if auditing of the NotAuthorizedException is enabled, otherwise returns false.

      Supported API: true
      Returns:
      boolean
      See Also:
    • reenableNotAuthorizedAudit

      public static void reenableNotAuthorizedAudit()
      Re-enables auditing of the NotAuthorizedException. The value of the MethodContext attribute that keeps track of the count of nested callers that have disabled auditing of exceptions is decremented. If the attribute's value goes to zero, auditing of exceptions is reenabled.

      Supported API: true