Check if specific access control is allowed from controller
@param ctx
@param topic
@param controllers
@return true if at least one specific topicAccessControl exist
@throws IllegalAccessException
196814
boolean checkAccessTopicFromController(UserContext ctx, String topic, JsTopicAccessController jsTopicAccessController) throws IllegalAccessException {
		logger.debug("Looking for accessController for topic '{}' from JsTopicAccessController {}", topic, jsTopicAccessController);
		JsTopicControls jsTopicControls = jsTopicControlsTools.getJsTopicControlsFromProxyClass(jsTopicAccessController.getClass());
		logger.debug("Looking for accessController for topic '{}' from jsTopicControls {}", topic, jsTopicControls);
		if(null != jsTopicControls) {
			logger.debug("Looking for accessController for topic '{}' from jsTopicControls {}, {}", topic, jsTopicControls, jsTopicControls.value());
			for (JsTopicControl jsTopicControl : jsTopicControls.value()) {
				if(topic.equals(jsTopicControl.value())) {
					logger.debug("Found accessController for topic '{}' from JsTopicControls annotation", topic);
					checkAccessTopicFromControllers(ctx, topic, Arrays.asList(jsTopicAccessController));
					return true;
				}
			}
		}
		return false;
	}
37451
public void postProcessMatches(DestinationHandler topicSpace,
                                 String topic,
                                 Object[] results,
                                 int index)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
	  SibTr.entry(tc, "postProcessMatches","results: "+Arrays.toString(results)+";index: "+index + ";topic"+topic);

    Set subRes = (Set) results[index];

    Iterator itr = subRes.iterator();

    if(authorization != null)
    {
      // If security is enabled then we'll do the permissions check
      if(authorization.isBusSecure())
      {
        if(topicSpace != null &&
           topicSpace.isTopicAccessCheckRequired()) // Bypass security checks
        {
          while (itr.hasNext())
          {
            MatchingConsumerDispatcher mcd = (MatchingConsumerDispatcher) itr.next();
			      ConsumerDispatcher cd = mcd.getConsumerDispatcher();
            String userid = cd.getConsumerDispatcherState().getUser();
            // We test whether the user is privileged only driving the full
            // permission check if not.
            if(!cd.getConsumerDispatcherState().isSIBServerSubject())
            {
              try
              {
            	if(!authorization.
                      checkPermissionToSubscribe(topicSpace,
                                                 topic,
                                                 userid,
                                                 (TopicAclTraversalResults)results[MessageProcessorMatchTarget.ACL_TYPE]))
                {
                  // Not authorized to subscribe to topic, need to remove from results
                  itr.remove();
                }
              }
              catch (Exception e)
              {
                // No FFDC code needed
              }
            }
          }
        }
      }
    }
    else
    {
      // Its a glitch and I need to feed this back. 	
    }
	
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
	  SibTr.exit(tc, "postProcessMatches");

  }
777952
protected static boolean useFieldAccessors ()
    {
        try {
            SecurityManager security = System.getSecurityManager();
            if (security != null) {
                security.checkPermission(new ReflectPermission("suppressAccessChecks"));
            }
            return false;
        } catch (SecurityException se) {
            return true;
        }
    }
549720
public boolean isDisabled(FaceletContext ctx) {
        return disabled != null && Boolean.TRUE.equals(disabled.getBoolean(ctx));
    }
759679
@Override
	public int registerTopicSession(String topic, Session session) throws IllegalAccessException {
		if (isInconsistenceContext(topic, session)) {
			return 0;
		}
		Collection<Session> sessions;
		if (map.containsKey(topic)) {
			sessions = map.get(topic);
		} else {
			sessions = Collections.synchronizedCollection(new ArrayList<Session>());
			map.put(topic, sessions);
		}
		topicAccessManager.checkAccessTopic(userContextFactory.getUserContext(session.getId()), topic);
		logger.debug("'{}' subscribe to '{}'", session.getId(), topic);
		if (session.isOpen()) {
			sessions.add(session);
		}
		return getNumberSubscribers(topic);
	}
398265
boolean checkAccessTopicGlobalAC(UserContext ctx, String topic) throws IllegalAccessException {
		logger.debug("Looking for accessController for topic '{}' from GlobalAccess", topic);
		Iterable<JsTopicAccessController> accessControls = topicAccessController.select(DEFAULT_AT);
		return checkAccessTopicFromControllers(ctx, topic, accessControls);
	}
741751
public boolean checkDestinationAccess(
    SecurityContext secContext,
    OperationType operation) 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "checkDestinationAccess",
        new Object[] { secContext, operation });

    boolean allow = false;

    // This style of access check is against a bus only.
    if(accessChecker.checkForeignBusAccess(secContext,
                              getName(),
                              operation))
    {
      allow = true;
    }
       
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "checkDestinationAccess", Boolean.valueOf(allow));

    return allow; 
  }
346844
public int checkAccessControl(Database database, String deviceName, TangoUrl devUrl) {
        int access = TangoConst.ACCESS_WRITE;
        synchronized (monitor) {
            if (database.devname==null)
                database.devname = database.device.name();
            if (deviceName.equals(database.devname) && database.isAccess_checked())
                return database.access;
            try {
                //	Else create proxy
                //	Check if AccessProxy object already exists
                if (/*!database.isAccess_checked() &&*/ database.getAccess_proxy()==null) {
                    //	Check if access deviceName is from env (for tests)
                    String access_deviceName = ApiUtil.getAccessDevname();
                    if (access_deviceName==null || access_deviceName.length()==0) {
                        if (access_service_read)
                            if (!database.check_access)
                                return TangoConst.ACCESS_WRITE;

                        //	Get Access service
                        String[] services =
                                getServices(database, TangoConst.ACCESS_SERVICE, "*");
                        if (services.length>0)
                            access_deviceName = services[0];
                        else {
                            //	if not set --> No check
                            //System.out.println("No Access Service Found !");
                            database.check_access = false;
                            access_service_read = true;
                            return TangoConst.ACCESS_WRITE;
                        }
                    }
                    // If tango_host not from env -> add tango_host as header for access device name
                    //  Check if header not already in access_deviceName :-)
                    if (!devUrl.fromEnv && !access_deviceName.startsWith("tango://"))
                        access_deviceName = "tango://" + devUrl.host + ":" + devUrl.port + "/" + access_deviceName;

                    //	Then build Tango Access Control Proxy
                    database.setAccess_proxy(new AccessProxy(access_deviceName));
                }
                if (database.getAccess_proxy()!=null) {
                    access = database.getAccess_proxy().checkAccessControl(deviceName);
                }

                //	if database access not already checked, and not first import -> do it now
                if (!database.isAccess_checked())
                    if (!deviceName.equals(database.device.name()))
                        checkAccess(database);

            } catch (DevFailed e) {
                //	In case of failure, returns always TangoConst.ACCESS_READ
                access = TangoConst.ACCESS_READ;
                //	if cannot import AccessProxy
                //	-> change description to be more explicit
                if (e.errors.length>1)
                    if (e.errors[1].reason.equals("TangoApi_CANNOT_IMPORT_DEVICE"))
                        e.errors[0].desc +=
                                "\nControlled access service defined in Db but unreachable --> Read Only access given to all devices...";

                database.setAccess_devfailed(e);
                //Except.print_exception(e);
            }
        }
        return access;
    }
434251
public function canAccessController(string $controllerName): bool
    {
        if (!isset($this->controllerDefaults[$controllerName])) {
            return false;
        }
        $requiredRoles = $this->controllerDefaults[$controllerName];
        if (!$requiredRoles) {
            return true;
        }

        if (!$this->user) {
            return false;
        }

        foreach ($requiredRoles as $role) {
            if ($this->hasRoleWithName($role)) {
                return true;
            }
        }

        return false;
    }
675996
public void checkAccessTopic(UserContext ctx, String topic) throws IllegalAccessException {
		boolean tacPresent0 = checkAccessTopicGlobalAC(ctx, topic);
		boolean tacPresent1 = checkAccessTopicFromJsTopicControl(ctx, topic);
		boolean tacPresent2 = checkAccessTopicFromJsTopicControls(ctx, topic);
		if (logger.isDebugEnabled() && !(tacPresent0 | tacPresent1 | tacPresent2)) {
			logger.debug("No '{}' access control found in project, add {} implementation annotated with {}({}) in your project for add subscription security.", topic, JsTopicAccessController.class, JsTopicControl.class, topic);
		}
	}
1014908
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_lock_topics(obj, user)
1234735
@Override
	public synchronized boolean checkPermission(Principal principal, Permission permission)
	{

		if (principal == null)
			return false;

		if (permission == null)
			return false;

		Set<AccessControl> set = this.entries.get(principal);

		if (set != null && !set.isEmpty())
		{
			for (AccessControl accessControl: set)
			{
				if (accessControl.checkPermission(permission))
					return true;
			}
		}

		// did not find for user, not check for groups
		if (SecurityUser.class.isAssignableFrom(principal.getClass()))
		{
			return checkPermission(((SecurityUser) principal).getGroups(), permission);
		}
		return false;
	}
23710
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_update_topics_to_announces(obj, user)
1335037
public boolean checkDiscriminatorAccess(
    SecurityContext secContext,
    OperationType operation) 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "checkDiscriminatorAccess",
        new Object[] { secContext, operation });

    // We don't apply discriminator access checks to foreign destinations
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "checkDiscriminatorAccess", Boolean.valueOf(true));

    return true; 
  }
169326
public void checkAuthorization(Action action, ContainerRequestContext requestContext) throws NotAuthorizedException {
		String clientApplicationName = (String)requestContext.getProperty(RequestHandler.APPSENSOR_CLIENT_APPLICATION_IDENTIFIER_ATTR);

		ClientApplication clientApplication = appSensorServer.getConfiguration().findClientApplication(clientApplicationName);
		
		appSensorServer.getAccessController().assertAuthorized(clientApplication, action, new Context());
	}
438015
public function canAccessAction(string $controllerName, string $action): bool
    {
        if (isset($this->actions[$controllerName][$action])) {
            if (!$this->actions[$controllerName][$action]) {
                return true;
            }

            foreach ($this->actions[$controllerName][$action] as $role) {
                if ($this->hasRoleWithName($role)) {
                    return true;
                }
            }

            return false;
        }

        return $this->canAccessController($controllerName);
    }
161285
public void setDefaultAccessController (AccessController controller)
    {
        AccessController oldDefault = _defaultController;
        _defaultController = controller;

        // switch all objects from the old default (null, usually) to the new default.
        for (DObject obj : _objects.values()) {
            if (oldDefault == obj.getAccessController()) {
                obj.setAccessController(controller);
            }
        }
    }