Beispiel #1
0
 /**
  * 
  * @param boolean $assignToDefaultRoleRoles assign new roles with default roles (\simplator\admin)
  */
 public function actionInit($assignToDefaultRoleRoles = true)
 {
     $auth = Yii::$app->authManager;
     $quick = new QuickRBAC();
     $quick->checkRole('settings.admin');
     $quick->checkRole('settings.user');
     $quick->checkPermission('settings.view');
     $quick->checkPermission('settings.update');
     $quick->checkPermission('settings.other');
     $quick->checkChild('settings.user', 'settings.view');
     $quick->checkChild('settings.admin', 'settings.update');
     $quick->checkChild('settings.admin', 'settings.other');
     if ($assignToDefaultRoleRoles) {
         $quick->checkChild('admin', 'settings.admin');
         $quick->checkChild('user', 'settings.user');
     }
 }
Beispiel #2
0
 /**
  * 
  * @param boolean $assignToDefaultRoleRoles assign new roles with default roles (\simplator\admin)
  */
 public function actionInit($assignToDefaultRoleRoles = true)
 {
     $auth = Yii::$app->authManager;
     $quick = new QuickRBAC();
     $quick->checkRole('articles.admin');
     $quick->checkRole('articles.moderator');
     $quick->checkRole('articles.author');
     $quick->checkRole('articles.reader');
     $quick->checkRule(ArticleUpdateOwn::className());
     $quick->checkPermission('articles.view');
     $quick->checkPermission('articles.article.create');
     $quick->checkPermission('articles.article.delete');
     $quick->checkPermission('articles.article.deleteOwn');
     $quick->checkPermission('articles.article.update');
     $quick->checkPermission('articles.article.updateOwn', NULL, 'articles.ArticleUpdateOwn');
     $quick->checkPermission('articles.article.preview');
     $quick->checkChild('articles.reader', 'articles.view');
     $quick->checkChild('articles.author', 'articles.reader');
     $quick->checkChild('articles.author', 'articles.article.create');
     $quick->checkChild('articles.author', 'articles.article.updateOwn');
     $quick->checkChild('articles.author', 'articles.article.preview');
     $quick->checkChild('articles.moderator', 'articles.author');
     $quick->checkChild('articles.moderator', 'articles.article.create');
     $quick->checkChild('articles.moderator', 'articles.article.update');
     $quick->checkChild('articles.moderator', 'articles.article.delete');
     $quick->checkChild('articles.admin', 'articles.moderator');
     if ($assignToDefaultRoleRoles) {
         $quick->checkChild('admin', 'articles.admin');
         $quick->checkChild('moderator', 'articles.moderator');
         $quick->checkChild('user', 'articles.reader');
         $quick->checkChild('guest', 'articles.reader');
     }
 }
Beispiel #3
0
 public function actionRevoke($permission, $userid)
 {
     $quick = new QuickRBAC();
     $quick->revokeByName($permission, $userid);
 }