framework/rbac/PhpManager.php
protected function getInheritedPermissionsByUser($userId)
    {
        $assignments = $this->getAssignments($userId);
        $result = [];
        foreach (array_keys($assignments) as $roleName) {
            $this->getChildrenRecursive($roleName, $result);
        }

        if (empty($result)) {
            return [];
        }

        $permissions = [];
        foreach (array_keys($result) as $itemName) {
            if (isset($this->items[$itemName]) && $this->items[$itemName] instanceof Permission) {
                $permissions[$itemName] = $this->items[$itemName];
            }
        }

        return $permissions;
    }
protected function getInheritedPermissionsByUser($userId)
    {
        $assignments = $this->getAssignments($userId);
        $result = [];
        foreach (array_keys($assignments) as $roleName) {
            $this->getChildrenRecursive($roleName, $result);
        }

        if (empty($result)) {
            return [];
        }

        $permissions = [];
        foreach (array_keys($result) as $itemName) {
            if (isset($this->items[$itemName]) && $this->items[$itemName] instanceof Permission) {
                $permissions[$itemName] = $this->items[$itemName];
            }
        }

        return $permissions;
    }
protected function getInheritedPermissionsByUser ( $ userId ) { $ assignments = $ this -> getAssignments ( $ userId ) ; $ result = [ ] ; foreach ( array_keys ( $ assignments ) as $ roleName ) { $ this -> getChildrenRecursive ( $ roleName , $ result ) ; } if ( empty ( $ result ) ) { return [ ] ; } $ permissions = [ ] ; foreach ( array_keys ( $ result ) as $ itemName ) { if ( isset ( $ this -> items [ $ itemName ] ) && $ this -> items [ $ itemName ] instanceof Permission ) { $ permissions [ $ itemName ] = $ this -> items [ $ itemName ] ; } } return $ permissions ; }
Returns all permissions that the user inherits from the roles assigned to him.
@param string|int $userId the user ID (see [[\yii\web\User::id]])
@return Permission[] all inherited permissions that the user has. The array is indexed by the permission names.
@since 2.0.7
Returns all permissions that the user inherits from the roles assigned to him .