H
H
hollanditkzn2017-03-17 17:32:27
Yii
hollanditkzn, 2017-03-17 17:32:27

Why am I showing all data to authorized users?

I took the mdmsoft / yii2-admin extension, but when I assign roles

public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
            'access' => [
                'class' => AccessControl::className(),
                'only' => ['index', 'create', 'delete', 'update', 'view'],
                'rules' => [
                    [
                        'actions' => ['index'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                    [
                        'actions' => ['create'],
                        'allow' => true,
                        'roles' => ['shop'],
                    ],
                    [
                        'actions' => ['delete'],
                        'allow' => true,
                        'roles' => ['admin'],
                    ],
                    [
                        'actions' => ['update'],
                        'allow' => true,
                        'roles' => ['admin'],
                    ],
                    [
                        'actions' => ['view'],
                        'allow' => true,
                        'roles' => ['admin']
                    ],
                ],
            ],
        ];

Link to github https://github.com/hollandit/crm.git
And I even have the role of shop opens those pages where only admin is specified

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-03-17
@hollanditkzn

1. I looked at your code, but I don’t see that you would have connected mdmsoft/yii2-admin somewhere. Give the path where something is connected, since there is no trace of 2 in the expected backend/config/main.php common/config/main.php and frontend/config/main.php
. You have an advanced template, and mdmsoft/yii2-admin made for basic
3. In order to deal with RBAC and then not wonder if something doesn’t work, you need to write a bicycle for it yourself 1 time. A muddy subject, but having understood then problems are very simply solved. And it is possible that your bike will be more interesting than the finished ones.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question