Commit 2acf0b31 by Qiang Xue

Merge pull request #3021 from zelenin/auth-guide-fix

Authorization auth guide fix
parents ab9d4d42 034ba5e6
...@@ -130,6 +130,8 @@ use yii\rbac\Rule; ...@@ -130,6 +130,8 @@ use yii\rbac\Rule;
class NotGuestRule extends Rule class NotGuestRule extends Rule
{ {
public $name = 'notGuestRule';
public function execute($params, $data) public function execute($params, $data)
{ {
return !Yii::$app->user->isGuest; return !Yii::$app->user->isGuest;
...@@ -152,17 +154,17 @@ return [ ...@@ -152,17 +154,17 @@ return [
], ],
'items' => [ 'items' => [
// HERE ARE YOUR MANAGEMENT TASKS // HERE ARE YOUR MANAGEMENT TASKS
'manageThing0' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => NULL, 'data' => NULL], 'manageThing0' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => null, 'data' => null],
'manageThing1' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => NULL, 'data' => NULL], 'manageThing1' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => null, 'data' => null],
'manageThing2' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => NULL, 'data' => NULL], 'manageThing2' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => null, 'data' => null],
'manageThing3' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => NULL, 'data' => NULL], 'manageThing3' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => null, 'data' => null],
// AND THE ROLES // AND THE ROLES
'guest' => [ 'guest' => [
'type' => Item::TYPE_ROLE, 'type' => Item::TYPE_ROLE,
'description' => 'Guest', 'description' => 'Guest',
'ruleName' => NULL, 'ruleName' => null,
'data' => NULL 'data' => null
], ],
'user' => [ 'user' => [
...@@ -173,7 +175,7 @@ return [ ...@@ -173,7 +175,7 @@ return [
'manageThing0', // User can edit thing0 'manageThing0', // User can edit thing0
], ],
'ruleName' => $notGuest->name, 'ruleName' => $notGuest->name,
'data' => NULL 'data' => null
], ],
'moderator' => [ 'moderator' => [
...@@ -183,8 +185,8 @@ return [ ...@@ -183,8 +185,8 @@ return [
'user', // Can manage all that user can 'user', // Can manage all that user can
'manageThing1', // and also thing1 'manageThing1', // and also thing1
], ],
'ruleName' => NULL, 'ruleName' => null,
'data' => NULL 'data' => null
], ],
'admin' => [ 'admin' => [
...@@ -194,8 +196,8 @@ return [ ...@@ -194,8 +196,8 @@ return [
'moderator', // can do all the stuff that moderator can 'moderator', // can do all the stuff that moderator can
'manageThing2', // and also manage thing2 'manageThing2', // and also manage thing2
], ],
'ruleName' => NULL, 'ruleName' => null,
'data' => NULL 'data' => null
], ],
'godmode' => [ 'godmode' => [
...@@ -205,8 +207,8 @@ return [ ...@@ -205,8 +207,8 @@ return [
'admin', // can do all that admin can 'admin', // can do all that admin can
'manageThing3', // and also thing3 'manageThing3', // and also thing3
], ],
'ruleName' => NULL, 'ruleName' => null,
'data' => NULL 'data' => null
], ],
], ],
]; ];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment