Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
newShopBack
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
newshop
newShopBack
Commits
5beca137
Commit
5beca137
authored
Dec 06, 2019
by
孙磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auth
Signed-off-by:
sunlei
<
sunlei@romens.cn
>
parent
d59e1901
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
ShopRbacNode.php
backend/models/v1/rbacuser/ShopRbacNode.php
+8
-0
ShopRbacRoleAccess.php
backend/models/v1/rbacuser/ShopRbacRoleAccess.php
+17
-1
No files found.
backend/models/v1/rbacuser/ShopRbacNode.php
View file @
5beca137
...
...
@@ -69,4 +69,12 @@ class ShopRbacNode extends BaseModel
'LEVEL'
=>
'Level'
,
];
}
//获取全部的权限节点
public
function
getAuthorityNodes
()
{
return
$query
=
static
::
find
()
->
select
(
'ID,NAME,TITLE,STATUS,PID'
)
->
where
([
'ifnull(STATUS,0)'
=>
1
])
->
all
();
}
}
backend/models/v1/rbacuser/ShopRbacRoleAccess.php
View file @
5beca137
...
...
@@ -29,7 +29,7 @@ class ShopRbacRoleAccess extends BaseModel
public
function
rules
()
{
return
[
[[
'NODE_ID'
],
'required'
],
[[
'NODE_ID'
],
'required'
,
'on'
=>
[
'create'
]
],
[[
'ROLE_ID'
,
'NODE_ID'
],
'string'
,
'max'
=>
20
],
[[
'ORG_GUID'
],
'string'
,
'max'
=>
50
],
];
...
...
@@ -46,4 +46,20 @@ class ShopRbacRoleAccess extends BaseModel
'ORG_GUID'
=>
'Org Guid'
,
];
}
//获取角色的权限
public
function
getRoleAuthorities
(
$id
)
{
return
$query
=
static
::
find
()
->
select
(
'ROLE_ID,NODE_ID'
)
->
where
([
'ROLE_ID'
=>
$id
])
->
asArray
()
->
all
();
}
//删除角色原有权限
public
function
delRoleAuthorities
(
$ROLE_ID
)
{
$roleAuth
=
static
::
find
()
->
where
([
'ROLE_ID'
=>
$ROLE_ID
])
->
one
();
$res
=
$roleAuth
->
delete
();
return
$res
;
}
}
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