Returns whether user has required delfoi action access

@param user user
@param actionName action
@return whether user role required action access
557578
public boolean hasDelfoiAccess(User user, DelfoiActionName actionName) {
    if (isSuperUser(user)) {
      return true;
    }
    
    DelfoiAction action = delfoiActionDAO.findByActionName(actionName.toString());
    if (action == null) {
      logger.info(String.format("ActionUtils.hasDelfoiAccess - undefined action: '%s'", actionName));
      return false;
    }
    
    UserRole userRole = getDelfoiRole(user);
    return hasDelfoiAccess(action, userRole);
  }
856839
private UserRole getDelfoiRole(User user) {
    Delfoi delfoi = getDelfoi();
    if (delfoi != null) {
      DelfoiUserDAO delfoiUserDAO = new DelfoiUserDAO();
      DelfoiUser delfoiUser = delfoiUserDAO.findByDelfoiAndUser(delfoi, user);
      return delfoiUser == null ? getEveryoneRole() : delfoiUser.getRole();
    }
    
    return getEveryoneRole();
  }
19629
public boolean isUserInRole(String role)
    {
        if (_servletHolder!=null)
            role=_servletHolder.getUserRoleLink(role);
        return _httpRequest.isUserInRole(role);
    }
1033695
public boolean hasRoleForUser(String name, String role) {
        List<String> roles = getRolesForUser(name);

        boolean hasRole = false;
        for (String r : roles) {
            if (r.equals(role)) {
                hasRole = true;
                break;
            }
        }

        return hasRole;
    }
1030351
def is_required(action):
    '''
    
    '''
    return not isinstance(action, _SubParsersAction) and (
    action.required == True and action.nargs not in ['*', '?'])
838095
function hasRole(user = null, role = null) {
  return user && role && user.hasRole(role);
}
864692
public boolean matchesControllerAndAction(String controller, String action) {
		prepareMatching();
		return  (controllerRequirement == null || ARStringUtil.equals(controllerRequirement, controller)) &&
				(actionRequirement == null || ARStringUtil.equals(actionRequirement, action));
	}
1201343
public static boolean currentUserHasRole(String... roles) {
    if (roles == null || roles.length == 0) return false;

    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication != null) {
      Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
      if (authorities == null) throw new IllegalStateException("No user currently logged in");

      for (String role : roles) {
        for (GrantedAuthority grantedAuthority : authorities) {
          if (role.equals(grantedAuthority.getAuthority())) return true;
        }
      }
    }
    return false;
  }
1041073
public final void checkPermission( String resource , String action ) throws JMSException
    {
        if (securityContext == null)
            return; // Security is disabled

        securityContext.checkPermission(resource, action);        
    }
1282761
public boolean isCurrentUserAdmin() throws RepositoryException {
    	boolean isAdmin = false;
        final JackrabbitSession session = (JackrabbitSession) getSession();
        final UserManager userManager = session.getUserManager();
        Authorizable a = userManager.getAuthorizable(getRequest().getUserPrincipal());
        if (a instanceof org.apache.jackrabbit.api.security.user.User) {
        	isAdmin = ((org.apache.jackrabbit.api.security.user.User)a).isAdmin();
        }
        return isAdmin;
    }
1170009
private function isAllowedAction(Action $action): bool
    {
        if ($this->owner instanceof Module) {
            $ownerId = $this->owner->getUniqueId();
            $id = $action->getUniqueId();
            if (!empty($ownerId) && strpos($id, $ownerId . '/') === 0) {
                $id = substr($id, strlen($ownerId) + 1);
            }
        } else {
            $id = $action->id;
        }

        foreach ($this->allowActions as $route) {
            if (substr($route, -1) === '*') {
                $route = rtrim($route, '*');
                if ($route === '' || strpos($id, $route) === 0) {
                    return true;
                }
            } else {
                if ($id === $route) {
                    return true;
                }
            }
        }

        return false;
    }
696778
public boolean isUserInRole(String role) {
        for (String assRole : getRoles()) {
            if (assRole.equalsIgnoreCase(role)) {
                return true;
            }
        }
        return false;
    }
469000
public boolean hasPermission(AccessControlList acl, String[] permission, Identity user)
   {

      String userId = user.getUserId();

      if (userId.equals(IdentityConstants.SYSTEM))
      {
         // SYSTEM has permission everywhere
         return true;
      }
      else if (userId.equals(acl.getOwner()))
      {
         // Current user is owner of node so has all privileges
         return true;
      }
      else if (userId.equals(IdentityConstants.ANONIM))
      {
         List<String> anyPermissions = acl.getPermissions(IdentityConstants.ANY);

         if (anyPermissions.size() < permission.length)
            return false;

         for (int i = 0; i < permission.length; i++)
         {
            if (!anyPermissions.contains(permission[i]))
               return false;
         }

         return true;
      }
      else
      {

         if (acl.getPermissionsSize() > 0 && permission.length > 0)
         {
            // check permission to perform all of the listed actions
            for (int i = 0; i < permission.length; i++)
            {
               // check specific actions
               if (!isPermissionMatch(acl.getPermissionsList(), permission[i], user))
                  return false;
            }
            return true;
         }
         return false;

      }
   }
1236807
protected function checkPermission(User $user, $model, $action)
    {
        $dataType = Admin::model('DataType');
        $dataType = $dataType->where('model_name', get_class($model))->first();

        return $user->hasPermission($action.'_'.$dataType->slug);
    }
1233818
private boolean forceQuitActiveAction(final Long actionId) {
        if (actionId != null) {
            try {
                deploymentManagement.forceQuitAction(actionId);
                return true;
            } catch (final CancelActionNotAllowedException e) {
                LOG.info("Force Cancel action not allowed exception :{}", e);
                return false;
            }
        }
        return false;
    }
1184912
public function isAuthorized($user = null) {
		$result = false;
		if (empty($this->prefixes) || !is_array($this->prefixes)) {
			return $result;
		}
		$rolePrefix = (string)$this->_objUserInfo->getUserField('prefix', $user);
		if (!empty($rolePrefix)) {
			if (!in_array($rolePrefix, $this->prefixes)) {
				return $result;
			}
			$prefixes = [$rolePrefix];
		} else {
			$prefixes = $this->prefixes;
		}

		$action = $this->_controller->request->param('action');
		foreach ($prefixes as $prefix) {
			if (mb_stripos($action, $prefix . '_') === 0) {
				$result |= true;
			} else {
				$result |= false;
			}
		}
		if (empty($rolePrefix)) {
			$result = !$result;
		}

		return (bool)$result;
	}
1369236
def has_permission(cls, user):
        
        # no login is needed, so its always fine
        if not cls.requires_login:
            return True

        # if user is somehow not logged in
        if not user.is_authenticated:
            return False

        # attribute permission_required is mandatory, returns tuple
        perms = cls.get_permission_required()
        # if perms are defined and empty, we skip checking
        if not perms:
            return True

        # get role of user, skip admin role
        role = user.urole.role.name
        if role == cls.ADMIN:
            return True

        # check if at least one permissions is valid
        for permission in perms:
            if cls.check_permission(role, permission):
                return True

        # permission denied
        return False