简体   繁体   中英

How can I make Access to folders in Yii?

In many folders, I make access with .htaccess file like this:

RewriteCond %{REQUEST_URI} !^/(web)
RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
RewriteRule ^css/(.*)$ web/css/$1 [L]

Also I use Rbac. How can I make access to folders only to admin?

Yii::app()->user->checkAccess('admin')

public function accessRules()
{   
    return array(
        array('allow',
            'actions'=>array('admin'),
            'roles'=>array('staff', 'devel'),
        ),
        array('deny',  // deny all users
            'users'=>array('*'),
        ),
    );
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM