yii2mod / yii2-settings

Persistent settings in Yii2
MIT License
102 stars 33 forks source link

How do I limit the access? #27

Closed moplin closed 6 years ago

moplin commented 6 years ago

How do I limit the access to settings just to an RBACK SUPERADMIN??

moplin commented 6 years ago

I am only hiding the route on route configuration. Any better way?

ihorchepurnyi commented 6 years ago

Hi, @moplin

  1. You need to create your own SettingController that extends from DefaultController
    
    <?php

namespace backend\controllers;

use yii\filters\AccessControl; use yii2mod\settings\controllers\DefaultController;

class SettingController extends DefaultController { /**

  1. You need to change the configuration for the setting module as follows:
        'settings' => [
            'class' => 'yii2mod\settings\Module',
            'controllerMap' => [
                'default' => [
                    'class' => 'backend\controllers\SettingController', // path to your controller
                ],
            ]
        ],