@param string $action
@param array  $actionData
@param array  $groups

@return array
332678
private function getSortedProcessors($action, $actionData, $groups)
    {
        $processors = [];
        foreach ($actionData as $priority => $priorityData) {
            foreach ($priorityData as $processor) {
                if (isset($processor[1][self::GROUP_ATTRIBUTE])) {
                    $group = $processor[1][self::GROUP_ATTRIBUTE];
                    if (!isset($groups[$action][$group])) {
                        throw new \RuntimeException(
                            \sprintf(
                                'The group "%s" is not defined. Processor: "%s".',
                                $group,
                                $processor[0]
                            )
                        );
                    }
                    $groupPriority = $groups[$action][$group];
                    $processorPriority = self::calculatePriority($priority, $groupPriority);
                } else {
                    $processorPriority = self::calculatePriority($priority);
                }
                $processors[$processorPriority][] = $processor;
            }
        }
        $processors = $this->sortByPriorityAndFlatten($processors);

        return $processors;
    }
709960
protected function mergeNamespaceGroup(array $action)
    {
        if (isset($this->groupAttributes['namespace']) && isset($action['uses'])) {
            $namespace = trim($this->groupAttributes['namespace'], '\\');

            $action['uses'] = $namespace ? $namespace.'\\'.$action['uses'] : $action['uses'];
        }

        return $action;
    }
380465
public function getGroupAction($groupActions = null) {
		if (!$this->_controller->request->is('post')) {
			return false;
		}

		$action = $this->_controller->request->data('FilterGroup.action');
		if (empty($action) || (!empty($groupActions) && !is_array($groupActions))) {
			return false;
		}

		if (empty($groupActions)) {
			return $action;
		} elseif (in_array($action, $groupActions)) {
			return $action;
		} else {
			return false;
		}
	}
459348
public function createMissingPermissions($groupId, array $actionMap)
    {
        $existingPaths = $this->getAllPermissionPathsForGroup($groupId);

        $missingPaths = array_diff(array_keys($actionMap), $existingPaths);

        if (empty($missingPaths)) {
            return;
        }

        $this->connection()->transactional(function () use ($missingPaths, $actionMap, $groupId) {
            foreach ($missingPaths as $missingPath) {
                $action = $actionMap[$missingPath];
                $this->save(
                    new GroupPermission([
                        'group_id' => $groupId,
                        'path' => $missingPath,
                        'plugin' => $action['plugin'],
                        'controller' => $action['controller'],
                        'action' => $action['action'],
                    ])
                );
            }
        });
    }
905170
protected function addGroupNamespaceToStringUses($action)
    {
        $groupStack = last($this->router->getGroupStack());

        if (isset($groupStack['namespace']) && strpos($action, '\\') !== 0) {
            return $groupStack['namespace'].'\\'.$action;
        }

        return $action;
    }
628388
protected function execute(string $action)
    {
        if (!$this->getCollectionName()) {
            return false;
        }

        $options = [
            'writeConcern' => new WriteConcern($this->getWriteConcern()),
        ];

        if ($result = $this->getDataMapper()->$action($this, $options)) {
            $this->syncOriginalAttributes();
        }

        return $result;
    }
38211
protected function getActionArguments($action, $vars = array()) {
        $reflectionObject = new \ReflectionObject($this);
        $method = $reflectionObject->getMethod($action);
        $parameters = $method->getParameters();
        $arguments = array();
        foreach ($parameters as $param) {
            $name = $param->getName();
            if (array_key_exists($name, $vars)) {
                $arguments[] = $this->parseParameter($vars[$name], $param);
                continue;
            }
            $value = $this->setActionArguments($name);

            if (!is_null($value)){
                $arguments[] = $this->parseParameter($value, $param);
                continue;
            }
            if ($param->isDefaultValueAvailable()) {
                $arguments[] = $param->getDefaultValue();
                continue;
            }
            throw new Exception(sprintf(
                __('%s ACTION`S %s DOES NOT HAVE VALUE!'), $action, $name));
        }
        return $arguments;
    }
1239345
protected function getAliasesForAction($action)
    {
        $actions = [];

        foreach ($this->manager->getAliases() as $aliasName => $alias) {
            if ($alias->hasAction($action)) {
                $actions[] = $aliasName;
            }
        }

        return $actions;
    }
96844
private function addRoute($types = '', $uri, $action = [])
    {

        if (is_string($action)) {
            $action = ['_controller' => $action];
        }

        if (is_array($action)) {
            if (isset($action['as'])) {
                AsCollector::addAs($action['as'], $uri);
            }
        }

        $types = (array)$types;

        foreach ($types as $type) {
            $type = mb_convert_case($type, MB_CASE_UPPER);

            $add = [
                'uri' => isset(static::$firing['when']) ? $this->createWhenUri($uri) : $uri,
                'action' => $action
            ];;

            // add group parameter to action variable
            if (isset(static::$firing['group'])) {
                $add['group'] = static::$firing['group'];
            }

            // add to collection
            static::$routes[$type][] = $add;
        }
        return $this;
    }
1112473
protected function registerGroup($group = null, $action = [])
    {
        if ($group !== null) {
            $this->group = $group['action'];
        } elseif (is_array($action) && isset($action['_group'])) {
            $groups = RouteCollector::getGroups();
            $group = $action['_group'];
            $this->group = isset($groups[$group]) ? $groups[$group] : null;
        }
    }
786104
public function filter($action = 'set') {
        $role = $this->Roles->newEntity();
        if ($this->request->session()->check('Roles')) {
            $session = $this->request->session()->read('Roles');
            $role = $this->Roles->patchEntity($role,  $session);
        }
        if ($this->request->is(['patch', 'post', 'put'])) {
            if ($action == 'unset') {
                $this->request->session()->delete('Roles');
            } else {
                $this->request->session()->write('Roles', $this->request->data);
            }
            $this->Flash->success(__('The role has been saved.'));
            return $this->redirect(['action' => 'index']);
        }
        $this->set(compact('role'));
        $this->set('_serialize', ['role']);
    }
202531
public static function getCapabilities(string $controllerName = null, array $actions = []): array
    {
        $result = [];

        if (empty($controllerName)) {
            return $result;
        }

        $skipControllers = Configure::read('RolesCapabilities.accessCheck.skipControllers');
        if (is_callable([$controllerName, 'getSkipControllers'])) {
            $skipControllers = array_merge($skipControllers, $controllerName::getSkipControllers());
        }

        if (in_array($controllerName, $skipControllers)) {
            return $result;
        }

        $actions = static::getActions($controllerName, $actions);

        if (empty($actions)) {
            return $result;
        }

        // get controller table instance
        $table = static::getControllerTableInstance($controllerName);

        $result = static::getCapabilitiesForAction($table, $controllerName, $actions);

        return $result;
    }
821794
public function post($action, $queryParams = [], $data = [])
    {
        return \GuzzleHttp\json_decode($this->getGuzzle()->post($this->getApiUrl($action, $queryParams), [
            'json' => $data
        ])->getBody(), true);
    }
450764
public function buildDataGridForm(
        Action $action,
        Request $request,
        DataGrid $dataGrid = null,
        array $formOptions = []
    ): DataGrid {
        if (null === $dataGrid) {
            $dataGrid = $this->getDataGrid($action);
        }
        $formOptions = array_merge(
            [
                'method' => $this->method,
                'csrf_protection' => false,
                'action' => $this->routingHelper->getCurrentUri($action, $request),
                'validation_groups' => ['filters'],
            ],
            $formOptions
        );

        // Create form with filters
        $builder = $this->formFactory->createBuilder(FormType::class, null, $formOptions);
        $dataGrid->buildForm($builder);

        return $dataGrid;
    }
1194156
protected function execute($action, array $parameters = [])
    {
        $parameters += $this->input;

        return $this->server->dispatch(
            new ServerRequest($action, $parameters)
        )->getData();
    }
117230
private function perform($action, $data)
    {
        if ($this->app->user->isGuest) {
            return [];
        }

        return Client::perform($action, $data);
    }
730583
public function getActionRequestsGroupByName($actionGroupName)
    {
        // Action Group is configured?
        if (!isset($this->actions[$actionGroupName])) {
            throw new NotConfiguredActionException(
                sprintf(
                    '[%s] No action group configured with the following name: %s.',
                    $this->getApiName(),
                    $actionGroupName
                ),
                $actionGroupName
            );
        }

        // Returning action group
        return $this->actions[$actionGroupName];
    }