mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 22:09:48 +08:00
Merge pull request #3021 from zelenin/auth-guide-fix
Authorization auth guide fix
This commit is contained in:
@@ -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 [
|
|||||||
],
|
],
|
||||||
'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 [
|
|||||||
'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 [
|
|||||||
'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 [
|
|||||||
'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 [
|
|||||||
'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
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user