The sample CustomAccessManagerImpl below extends the default access manager and uses some DecisionMakingService in the overloaded hasPermission method to find out if a current user has permission to use current item, event type, userID and some parameter of AccessManager. To make this Access manager work, it is necessary to configure it in jcr configuration as mentioned in Custom Extended Access Manager and SetAccessContextAction should be configured in the way mentioned in Access Context Action.

public class CustomAccessManagerImpl extends AccessManager {


  private String property;
  private DecisionMakingService theService;
  public CustomAccessManagerImpl (RepositoryEntry config, WorkspaceEntry wsConfig,
      OrganizationService orgService, DecisionMakingService someService) throws RepositoryException {
    super(config, wsConfig, orgService);
    this.property = wsConfig.getAccessManager().getParameterValue("someParam");
    this.theService = someService;  
  }
  @Override
  public boolean hasPermission(AccessControlList acl, String[] permission, String userId) {
    // call the default permission check
    if (super.hasPermission(acl, permission, userId)) {
      
      Item curItem = context().getCurrentItem();
      int eventType = context().getEventType();
      ExoContainer container = context().getContainer();
// call some service's method
      return theService.makeDecision(curItem, eventType, userId, property);
    } else {
      return false;
    }
  }
}