Code Monkey home page Code Monkey logo

yii2-start-rbac-module's People

Contributors

saochico avatar vova07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yii2-start-rbac-module's Issues

Configuracion DBManager

Primero muchas gracias por compartir el modulo, veo que esta configurado para PHPManager, el cual funciona genial, estoy revisando para colocarlo usando DBManager, la cree las tablas desde su sql, me falló algo en la migracion, podrias darme una vision general, seguire revisando hasta lograrlo, si puedes darme algo de apoyo/opinion sobre el tema, te lo agradecería

Saludos

Removing unsupported object type.

Здравствуйте, Василий.
Изучаю ваши модули. Возник вопрос по разрешениям.

по аналогии с Вашим классом в комментариях
https://github.com/vova07/yii2-start-comments-module/blob/master/commands/RbacController.php

, написал

class ArticleController extends Controller{
    /**
     * @inheritdoc
     */
    public $defaultAction = 'add';
    /**
     * @var array Main module permission array
     */
    public $mainPermission = [
        'name' => 'administrateArticles',
        'description' => 'Can administrate all "Articles" module'
    ];
    /**
     * @var array Permission
     */
    public $permissions = [

        'BViewArticles' => [
            'description' => 'Can view backend articles list'
        ],
        'BUpdateArticles' => [
            'description' => 'Can update backend articles'
        ],
// more permissions
    ];


    /**
     * Add Articles RBAC.
     */
    public function actionAdd()
    {
        $auth = Yii::$app->authManager;
        $root = $auth->getRole('root');
// some code............................

        return static::EXIT_CODE_NORMAL;
    }

    /**
     * Remove articles RBAC.
     */
    public function actionRemove()
    {
        $auth = Yii::$app->authManager;
        $permissions = array_keys($this->permissions);
        foreach ($permissions as $name => $option) {
            $permission = $auth->getPermission($name);
//var_dump($permission); // тут показывает NULL
            $auth->remove($permission);
        }
        $mainPermission = $auth->getPermission($this->mainPermission['name']);
        $auth->remove($mainPermission);
        return static::EXIT_CODE_NORMAL;
    }
} 
  • при выполнении add - разрешения добавляются корректно.
  • пр удалении - появляется ошибка
Exception 'yii\base\InvalidParamException' with message 'Removing unsupported object type.'

in \vendor\yiisoft\yii2\rbac\BaseManager.php:136

сама функция тут https://github.com/yiisoft/yii2/blob/master/framework/rbac/BaseManager.php#L129

вывел var_dump($permission); - - у меня показывает NULL


p.s. - вначале вопрос был по этому модулю, но в процессе я его решил, но заметил другую ошибку. Так что извините, что не там написал issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.