/** * Initial RBAC action * @param integer $id Superadmin ID */ public function actionInit($id = null) { $auth = new PhpManager(); $auth->init(); $auth->removeAll(); //удаляем старые данные // Rules $groupRule = new GroupRule(); $auth->add($groupRule); // Roles $user = $auth->createRole('user'); $user->description = 'User'; $user->ruleName = $groupRule->name; $auth->add($user); $moderator = $auth->createRole('moderator'); $moderator->description = 'Moderator'; $moderator->ruleName = $groupRule->name; $auth->add($moderator); $auth->addChild($moderator, $user); $admin = $auth->createRole('admin'); $admin->description = 'Admin'; $admin->ruleName = $groupRule->name; $auth->add($admin); $auth->addChild($admin, $moderator); // $auth->assign($admin, 1); }
public function removeAll() { parent::removeAll(); $this->trigger(self::EVENT_REMOVE_ALL, new RemoveAllEvent()); }