Similar to controller access, see if the config array grants the current user (or guest) access to a specific
action on a given controller.

@param $controllerName
@param $action

@return bool
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);
    }
738516
protected function actionReferencesController($action)
    {
        if ($action instanceof Closure) {
            return false;
        }

        return is_string($action) || is_string(array_get($action, 'uses'));
    }
493400
public function hasAccess($action, $object = null)
    {
        $access = $this->getAccess();

        if (!\array_key_exists($action, $access)) {
            return false;
        }

        if (!\is_array($access[$action])) {
            $access[$action] = [$access[$action]];
        }

        foreach ($access[$action] as $role) {
            if (false === $this->isGranted($role, $object)) {
                return false;
            }
        }

        return true;
    }
1057918
public function setAction($action)
    {
        $result           = false;
        $actionsAvailable = $this->getActionsInfo();
        if (is_array($actionsAvailable) && array_key_exists($action,
                $actionsAvailable)) {
            $this->action = $action;
            $result       = true;
        }
        return $result;
    }
464279
protected function authorize(?string $action = null): bool
    {
        if (empty($action)) {
            return false;
        }

        return $this->foundation->acl()->can($action);
    }
673712
public function reverseRoute( $controllerName, $actionName )
    {
        // Create a temp route because formatting
        $tempRoute = new Route( ["controllerName" => $controllerName, "actionName" => $actionName] );

        foreach ( $this->_routeDefinitions as $routeDefinition )
        {
            $route = call_user_func($routeDefinition);

            if ( $tempRoute->getControllerName() == $route->getControllerName() && $tempRoute->getActionName() == $route->getActionName() )
            {
                return $route->getUri();
            }
        }
    }
152318
public static function generateCapabilityName(string $controllerName, string $action): string
    {
        $result = 'cap__' . $controllerName . '__' . $action;

        return $result;
    }
307902
public function userAllowed($action)
    {
        if (user()->isAdmin()) {
            return true;
        }

        $this->_loadPermissions();
        $allowedRoles = $this->_permissions
            ->filter(function ($rule) use ($action) {
                return $rule->get('action') == $action;
            })
            ->extract('role_id')
            ->toArray();
        $intersect = array_intersect($allowedRoles, user()->get('role_ids'));

        return !empty($intersect);
    }
828125
public function Link($action = null)
    {
        if ($this->hasParentPage()) {
            return Controller::join_links(
                $this->hasParentPage()->Link(),
                $this->hasViewAction(),
                $this->owner->RelativeLink($action)
            );
        }

        return false;
    }
72994
public static function hasAccess(User $user, $controller, $action, $parameters) {
        $access = true;
        foreach (self::getImplementations() as $impl) {
            $access = $access && $impl->hasAccess($user, $controller, $action, $parameters);
        }
        return $access;
    }
353618
public function doAction($action)
    {
        $controller = $this->getOption('hooks-controller');
        $instance = $this->getControllerInstance($controller);

        if (is_object($instance) && method_exists($instance, $action)) {
            $response = call_user_func([$instance, $action]);
        }

        $this->setAction('');

        return isset($response);
    }
123122
public function hasActionTemplate($action)
    {
        if (isset($this->templates[$action])) {
            return true;
        }

        $parentClass = static::class;
        $templates   = array();

        while ($parentClass != __CLASS__) {
            $templates[] = strtok($parentClass, '_') . '_' . $action;
            $parentClass = get_parent_class($parentClass);
        }

        return SSViewer::hasTemplate($templates);
    }
984652
public function matchesControllerActionPair($controllerObjectName, $actionName)
    {
        $controllerActionPairs = $this->getControllerActionPairs();
        return isset($controllerActionPairs[$controllerObjectName]) && in_array($actionName, $controllerActionPairs[$controllerObjectName]);
    }
678052
public function existsController($name, $action = null)
    {
        $names = explode('_', $name);
        array_unshift($names, 'Controller');
        $base = join(DS, array_map('ucfirst', $names)) . 'Controller.php';

        $file = $this->loader->findFirst($base);
        if ($file) {
            $class = $file->getClassName();
            if (! $action && class_exists($class)) return true;
            
            $action = $this->actionNameStrategy($action);
            if (method_exists($class, $action)) return true;
        }

        return false;
    }
1318404
public static function getControllerAccess($controllerClassName)
    {
        try{
            $returnValue = self::getCacheImplementation()->get(self::SERIAL_PREFIX_MODULE.$controllerClassName);
        } catch (\common_cache_Exception $e) {
            
            $extId = MapHelper::getExtensionFromController($controllerClassName);
            $extension = MapHelper::getUriForExtension($extId);
            $module = MapHelper::getUriForController($controllerClassName);
            
            $roleClass = new \core_kernel_classes_Class(GenerisRdf::CLASS_ROLE);
            $accessProperty = new \core_kernel_classes_Property(AccessService::PROPERTY_ACL_GRANTACCESS);

            $returnValue = array('module' => array(), 'actions' => array());
            
            // roles by extensions
            $roles = $roleClass->searchInstances(array(
                    $accessProperty->getUri() => $extension
                ), array(
                    'recursive' => true, 'like' => false
            ));
            foreach ($roles as $grantedRole) {
                $returnValue['module'][] = $grantedRole->getUri();
            }
            
            // roles by controller
            $filters = array(
                $accessProperty->getUri() => $module
            );
            $options = array('recursive' => true, 'like' => false);
            
            foreach ($roleClass->searchInstances($filters, $options) as $grantedRole){
                $returnValue['module'][] = $grantedRole->getUri();
            }
            
            // roles by action
            foreach (ControllerHelper::getActions($controllerClassName) as $actionName) {
                $actionUri = MapHelper::getUriForAction($controllerClassName, $actionName);
                $rolesForAction = $roleClass->searchInstances(array(
                    $accessProperty->getUri() => $actionUri
                ), array('recursive' => true, 'like' => false));
                if (!empty($rolesForAction)) {
                    $actionName = MapHelper::getActionFromUri($actionUri);
                    $returnValue['actions'][$actionName] = array();
                    foreach ($rolesForAction as $roleResource) {
                        $returnValue['actions'][$actionName][] = $roleResource->getUri();
                    }
                }
            }
            
            self::getCacheImplementation()->put($returnValue, self::SERIAL_PREFIX_MODULE.$controllerClassName);
        }
        return $returnValue;
    }
196271
public function allowActions($controller, $action){
		$cid = $controller->id;

		// If NULL remove all excluded actions
		if(is_null($action)){
			$this->excluded_actions[$cid] = array();
			return $this;
		}

		$action = is_array($action) ? $action : array($action);

		if(!isset($this->excluded_actions[$cid])){
			$this->excluded_actions[$cid] = array();
		}

		$this->excluded_actions[$cid] = array_diff($this->excluded_actions[$cid], $action);

		return $this;
	}
1307249
public function getControllerAndAction($controller, $action, $controllerDir = '')
    {
        $controller = $this->getControllerName($controller, $controllerDir);
        $action = $this->getActionName($action);

        return [$controller, $action];
    }