Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-auth-client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b4f184f0
authored
May 10, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
业务数据权限控制
1 parent
a9ac219e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
4 deletions
src/main/java/cn/com/glsx/auth/model/BizPermissionType.java
src/main/java/cn/com/glsx/auth/model/Role.java
src/main/java/cn/com/glsx/auth/utils/ShieldContextHolder.java
src/main/java/cn/com/glsx/auth/model/BizPermissionType.java
0 → 100644
View file @
b4f184f
package
cn
.
com
.
glsx
.
auth
.
model
;
import
lombok.Data
;
@Data
public
class
BizPermissionType
{
/**
* 业务数据权限(1结清数据)
*/
private
Integer
type
;
/**
* 业务数据权限可见度(1可见,2不可见)
*/
private
Integer
visibility
;
}
src/main/java/cn/com/glsx/auth/model/Role.java
View file @
b4f184f
...
@@ -23,6 +23,14 @@ public class Role {
...
@@ -23,6 +23,14 @@ public class Role {
*/
*/
private
Integer
rolePermissionType
;
private
Integer
rolePermissionType
;
/**
* 业务数据
*/
private
List
<
BizPermissionType
>
bizPermissionTypes
;
/**
* 菜单权限
*/
private
List
<
MenuPermission
>
menuPermissionList
;
private
List
<
MenuPermission
>
menuPermissionList
;
}
}
src/main/java/cn/com/glsx/auth/utils/ShieldContextHolder.java
View file @
b4f184f
package
cn
.
com
.
glsx
.
auth
.
utils
;
package
cn
.
com
.
glsx
.
auth
.
utils
;
import
cn.com.glsx.auth.model.Department
;
import
cn.com.glsx.auth.model.*
;
import
cn.com.glsx.auth.model.Role
;
import
cn.com.glsx.auth.model.SyntheticUser
;
import
cn.com.glsx.auth.model.Tenant
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
...
@@ -124,6 +121,12 @@ public class ShieldContextHolder {
...
@@ -124,6 +121,12 @@ public class ShieldContextHolder {
return
role
;
return
role
;
}
}
public
static
List
<
BizPermissionType
>
getRoleBizPermissionTypes
()
{
Role
role
=
getUser
().
getRoles
().
get
(
0
);
Assert
.
notNull
(
role
,
"获取当前用户角色信息失败"
);
return
role
.
getBizPermissionTypes
();
}
public
static
Long
getRoleId
()
{
public
static
Long
getRoleId
()
{
return
getRole
().
getRoleId
();
return
getRole
().
getRoleId
();
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment