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;
class NotGuestRule extends Rule
{
public $name = 'notGuestRule';
public function execute($params, $data)
{
return !Yii::$app->user->isGuest;
......@@ -152,17 +154,17 @@ return [
],
'items' => [
// HERE ARE YOUR MANAGEMENT TASKS
'manageThing0' => ['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],
'manageThing3' => ['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],
'manageThing2' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => null, 'data' => null],
'manageThing3' => ['type' => Item::TYPE_OPERATION, 'description' => '...', 'ruleName' => null, 'data' => null],
// AND THE ROLES
'guest' => [
'type' => Item::TYPE_ROLE,
'description' => 'Guest',
'ruleName' => NULL,
'data' => NULL
'ruleName' => null,
'data' => null
],
'user' => [
......@@ -173,7 +175,7 @@ return [
'manageThing0', // User can edit thing0
],
'ruleName' => $notGuest->name,
'data' => NULL
'data' => null
],
'moderator' => [
......@@ -183,8 +185,8 @@ return [
'user', // Can manage all that user can
'manageThing1', // and also thing1
],
'ruleName' => NULL,
'data' => NULL
'ruleName' => null,
'data' => null
],
'admin' => [
......@@ -194,8 +196,8 @@ return [
'moderator', // can do all the stuff that moderator can
'manageThing2', // and also manage thing2
],
'ruleName' => NULL,
'data' => NULL
'ruleName' => null,
'data' => null
],
'godmode' => [
......@@ -205,8 +207,8 @@ return [
'admin', // can do all that admin can
'manageThing3', // and also thing3
],
'ruleName' => NULL,
'data' => NULL
'ruleName' => 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