getAuthManager(); $commentownrule = new CommentOwnRule(); $auth->add($commentownrule); $auth->add(new Permission([ 'name' => 'Update own comment', 'ruleName' => $commentownrule->name, 'description' => 'Can update own comment', ])); $auth->add(new Permission([ 'name' => 'Delete own comment', 'ruleName' => $commentownrule->name, 'description' => 'Can delete own comment', ])); return 'Success'; } public function actionUpdate() { $auth = \Yii::$app->getAuthManager(); $commentownrule = new CommentOwnRule(); $auth->add(new Permission([ 'name' => \rmrevin\yii\module\Comments\Permission::CREATE, 'description' => 'Can create own comments', ])); $auth->add(new Permission([ 'name' => \rmrevin\yii\module\Comments\Permission::UPDATE, 'description' => 'Can update all comments', ])); $auth->add(new Permission([ 'name' => \rmrevin\yii\module\Comments\Permission::UPDATE_OWN, 'ruleName' => $commentownrule->name, 'description' => 'Can update own comments', ])); $auth->add(new Permission([ 'name' => \rmrevin\yii\module\Comments\Permission::DELETE, 'description' => 'Can delete all comments', ])); $auth->add(new Permission([ 'name' => \rmrevin\yii\module\Comments\Permission::DELETE_OWN, 'ruleName' => $commentownrule->name, 'description' => 'Can delete own comments', ])); echo 'ok'; return 'ok'; } }