/**
  * Show available roles.
  * @param string $roleName role name.
  */
 public function actionIndex($roleName = '')
 {
     if ($roleName) {
         $roles = [$this->getRole($roleName)];
     } else {
         $roles = $this->_auth->getRoles();
     }
     foreach ($roles as $role) {
         $this->stdout($role->name . PHP_EOL);
         $permissions = $this->_auth->getPermissionsByRole($role->name);
         foreach ($permissions as $permission) {
             $this->stdout("- {$permission->name}\n");
         }
     }
 }
Esempio n. 2
0
 /**
  * Roles list
  *
  * @return mixed
  */
 public function actionIndex()
 {
     $provider = new ArrayDataProvider(['allModels' => $this->authManager->getRoles(), 'pagination' => ['pageSize' => 10]]);
     return $this->render('index', ['dataProvider' => $provider]);
 }