Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
b47d1836
Commit
b47d1836
authored
6 years ago
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
68332f2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
AuthController.php
backend/controllers/AuthController.php
+3
-2
No files found.
backend/controllers/AuthController.php
View file @
b47d1836
...
...
@@ -56,6 +56,7 @@ class AuthController extends BaseController
* 添加“角色”
* 注意:角色表的“rule_name”字段必须为“NULL”,不然会出错。
* 详情见“yii\rbac\BaseManager”的203行if($item->ruleName === null){return true;}
* @throws \Exception|\Throwable
* ---------------------------------------
*/
public
function
actionAdd
()
...
...
@@ -76,8 +77,8 @@ class AuthController extends BaseController
$role
->
description
=
$data
[
'description'
];
if
(
Yii
::
$app
->
authManager
->
add
(
$role
))
{
$auth
=
Yii
::
$app
->
authManager
;
$administrator
=
$auth
->
getRole
();
// Yii::$app->authManager->addChild(
);
$administrator
=
$auth
->
getRole
(
'administrator'
);
$auth
->
addChild
(
$administrator
,
$role
);
$this
->
success
(
'添加成功!'
,
$this
->
getForward
());
}
$this
->
error
(
'添加失败!'
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment