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;
    }
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;
    }
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 ; }
Returns Controller permission capabilities.

@param  string $controllerName Controller name
@param  mixed[]  $actions        Controller actions
@return mixed[]
Returns Controller permission capabilities .