|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Facades for Yii 2 |
|
4
|
|
|
* |
|
5
|
|
|
* Generated on Yii 2.0.12 |
|
6
|
|
|
* |
|
7
|
|
|
* @see https://github.com/sergeymakinen/yii2-facades |
|
8
|
|
|
* @copyright Copyright (c) 2016-2017 Sergey Makinen (https://makinen.ru) |
|
9
|
|
|
* @license https://github.com/sergeymakinen/yii2-facades/blob/master/LICENSE The MIT License |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace sergeymakinen\facades; |
|
13
|
|
|
|
|
14
|
|
|
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ |
|
15
|
|
|
/** |
|
16
|
|
|
* Yii::$app->get('auth') facade. |
|
17
|
|
|
* |
|
18
|
|
|
* Methods |
|
19
|
|
|
* |
|
20
|
|
|
* @method static bool add(\yii\rbac\Role|\yii\rbac\Permission|\yii\rbac\Rule $object) Adds a role, permission or rule to the RBAC system. |
|
21
|
|
|
* @see \yii\rbac\ManagerInterface::add |
|
22
|
|
|
* |
|
23
|
|
|
* @method static bool addChild(\yii\rbac\Item $parent, \yii\rbac\Item $child) Adds an item as a child of another item. |
|
24
|
|
|
* @see \yii\rbac\ManagerInterface::addChild |
|
25
|
|
|
* |
|
26
|
|
|
* @method static \yii\rbac\Assignment assign(\yii\rbac\Role $role, string|int $userId) Assigns a role to a user. |
|
27
|
|
|
* @see \yii\rbac\ManagerInterface::assign |
|
28
|
|
|
* |
|
29
|
|
|
* @method static bool canAddChild(\yii\rbac\Item $parent, \yii\rbac\Item $child) Checks the possibility of adding a child to parent. |
|
30
|
|
|
* @see \yii\rbac\ManagerInterface::canAddChild |
|
31
|
|
|
* |
|
32
|
|
|
* @method static bool checkAccess(string|int $userId, string $permissionName, array $params = []) Checks if the user has the specified permission. |
|
33
|
|
|
* @see \yii\rbac\CheckAccessInterface::checkAccess |
|
34
|
|
|
* |
|
35
|
|
|
* @method static \yii\rbac\Permission createPermission(string $name) Creates a new Permission object. |
|
36
|
|
|
* @see \yii\rbac\ManagerInterface::createPermission |
|
37
|
|
|
* |
|
38
|
|
|
* @method static \yii\rbac\Role createRole(string $name) Creates a new Role object. |
|
39
|
|
|
* @see \yii\rbac\ManagerInterface::createRole |
|
40
|
|
|
* |
|
41
|
|
|
* @method static null|\yii\rbac\Assignment getAssignment(string $roleName, string|int $userId) Returns the assignment information regarding a role and a user. |
|
42
|
|
|
* @see \yii\rbac\ManagerInterface::getAssignment |
|
43
|
|
|
* |
|
44
|
|
|
* @method static \yii\rbac\Assignment[] getAssignments(string|int $userId) Returns all role assignment information for the specified user. |
|
45
|
|
|
* @see \yii\rbac\ManagerInterface::getAssignments |
|
46
|
|
|
* |
|
47
|
|
|
* @method static \yii\rbac\Role[] getChildRoles(string $roleName) Returns child roles of the role specified. |
|
48
|
|
|
* @see \yii\rbac\ManagerInterface::getChildRoles |
|
49
|
|
|
* |
|
50
|
|
|
* @method static \yii\rbac\Item[] getChildren(string $name) Returns the child permissions and/or roles. |
|
51
|
|
|
* @see \yii\rbac\ManagerInterface::getChildren |
|
52
|
|
|
* |
|
53
|
|
|
* @method static null|\yii\rbac\Permission getPermission(string $name) Returns the named permission. |
|
54
|
|
|
* @see \yii\rbac\ManagerInterface::getPermission |
|
55
|
|
|
* |
|
56
|
|
|
* @method static \yii\rbac\Permission[] getPermissions() Returns all permissions in the system. |
|
57
|
|
|
* @see \yii\rbac\ManagerInterface::getPermissions |
|
58
|
|
|
* |
|
59
|
|
|
* @method static \yii\rbac\Permission[] getPermissionsByRole(string $roleName) Returns all permissions that the specified role represents. |
|
60
|
|
|
* @see \yii\rbac\ManagerInterface::getPermissionsByRole |
|
61
|
|
|
* |
|
62
|
|
|
* @method static \yii\rbac\Permission[] getPermissionsByUser(string|int $userId) Returns all permissions that the user has. |
|
63
|
|
|
* @see \yii\rbac\ManagerInterface::getPermissionsByUser |
|
64
|
|
|
* |
|
65
|
|
|
* @method static null|\yii\rbac\Role getRole(string $name) Returns the named role. |
|
66
|
|
|
* @see \yii\rbac\ManagerInterface::getRole |
|
67
|
|
|
* |
|
68
|
|
|
* @method static \yii\rbac\Role[] getRoles() Returns all roles in the system. |
|
69
|
|
|
* @see \yii\rbac\ManagerInterface::getRoles |
|
70
|
|
|
* |
|
71
|
|
|
* @method static \yii\rbac\Role[] getRolesByUser(string|int $userId) Returns the roles that are assigned to the user via [[assign()]]. |
|
72
|
|
|
* @see \yii\rbac\ManagerInterface::getRolesByUser |
|
73
|
|
|
* |
|
74
|
|
|
* @method static null|\yii\rbac\Rule getRule(string $name) Returns the rule of the specified name. |
|
75
|
|
|
* @see \yii\rbac\ManagerInterface::getRule |
|
76
|
|
|
* |
|
77
|
|
|
* @method static \yii\rbac\Rule[] getRules() Returns all rules available in the system. |
|
78
|
|
|
* @see \yii\rbac\ManagerInterface::getRules |
|
79
|
|
|
* |
|
80
|
|
|
* @method static array getUserIdsByRole(string $roleName) Returns all user IDs assigned to the role specified. |
|
81
|
|
|
* @see \yii\rbac\ManagerInterface::getUserIdsByRole |
|
82
|
|
|
* |
|
83
|
|
|
* @method static bool hasChild(\yii\rbac\Item $parent, \yii\rbac\Item $child) Returns a value indicating whether the child already exists for the parent. |
|
84
|
|
|
* @see \yii\rbac\ManagerInterface::hasChild |
|
85
|
|
|
* |
|
86
|
|
|
* @method static bool remove(\yii\rbac\Role|\yii\rbac\Permission|\yii\rbac\Rule $object) Removes a role, permission or rule from the RBAC system. |
|
87
|
|
|
* @see \yii\rbac\ManagerInterface::remove |
|
88
|
|
|
* |
|
89
|
|
|
* @method static void removeAll() Removes all authorization data, including roles, permissions, rules, and assignments. |
|
90
|
|
|
* @see \yii\rbac\ManagerInterface::removeAll |
|
91
|
|
|
* |
|
92
|
|
|
* @method static void removeAllAssignments() Removes all role assignments. |
|
93
|
|
|
* @see \yii\rbac\ManagerInterface::removeAllAssignments |
|
94
|
|
|
* |
|
95
|
|
|
* @method static void removeAllPermissions() Removes all permissions. |
|
96
|
|
|
* @see \yii\rbac\ManagerInterface::removeAllPermissions |
|
97
|
|
|
* |
|
98
|
|
|
* @method static void removeAllRoles() Removes all roles. |
|
99
|
|
|
* @see \yii\rbac\ManagerInterface::removeAllRoles |
|
100
|
|
|
* |
|
101
|
|
|
* @method static void removeAllRules() Removes all rules. |
|
102
|
|
|
* @see \yii\rbac\ManagerInterface::removeAllRules |
|
103
|
|
|
* |
|
104
|
|
|
* @method static bool removeChild(\yii\rbac\Item $parent, \yii\rbac\Item $child) Removes a child from its parent. |
|
105
|
|
|
* @see \yii\rbac\ManagerInterface::removeChild |
|
106
|
|
|
* |
|
107
|
|
|
* @method static bool removeChildren(\yii\rbac\Item $parent) Removed all children form their parent. |
|
108
|
|
|
* @see \yii\rbac\ManagerInterface::removeChildren |
|
109
|
|
|
* |
|
110
|
|
|
* @method static bool revoke(\yii\rbac\Role $role, string|int $userId) Revokes a role from a user. |
|
111
|
|
|
* @see \yii\rbac\ManagerInterface::revoke |
|
112
|
|
|
* |
|
113
|
|
|
* @method static bool revokeAll(mixed $userId) Revokes all roles from a user. |
|
114
|
|
|
* @see \yii\rbac\ManagerInterface::revokeAll |
|
115
|
|
|
* |
|
116
|
|
|
* @method static bool update(string $name, \yii\rbac\Role|\yii\rbac\Permission|\yii\rbac\Rule $object) Updates the specified role, permission or rule in the system. |
|
117
|
|
|
* @see \yii\rbac\ManagerInterface::update |
|
118
|
|
|
*/ |
|
119
|
|
|
class Auth extends Facade |
|
120
|
|
|
{ |
|
121
|
|
|
/** |
|
122
|
|
|
* @inheritDoc |
|
123
|
|
|
*/ |
|
124
|
1 |
|
public static function getFacadeComponentId() |
|
125
|
|
|
{ |
|
126
|
1 |
|
return 'auth'; |
|
127
|
|
|
} |
|
128
|
|
|
} |
|
129
|
|
|
|