文章

统一用户权限系统设计

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
user
-
id bigint PK
account varchar(50)
nickname varchar(50)
password varchar(200)
email varchar(100)
createdate datetime

user_organization
-
id bigint pk
user_id bigint fk - user.id
organization_id bigint fk - organization.id

organization
-
id bigint pk
name varchar(50)
parentId bigint

post 
-
id bigint pk
code varchar(20)
name varchar(50)

post_organization
-
id bigint pk
organization_id bigint fk - organization.id
post_id bigint fk - post.id

user_post
-
id bigint pk
user_id bigint fk - user.id
post_id bigint fk - post.id

role
-
id bigint PK
permission_space_id bigint fk - permission_space.id
name varchar(50)

user_role
-
id bigint PK
user_id bigint FK - user.id
role_id bigint fk - role.id

application
-
id bigint PK
name varchar(100)
description varchar(100)
app_key varchar(50)
app_secret varchar(100)
callback varchar(255)

permission_space
-
id bigint pk
name varchar(50)
code varchar(50) fk - application.id
description varchar(200)

resource
-
id bigint pk
name varchar(50)
code varchar(50)
permission_space_id bigint fk - permission_space.id
type tinyint commnet "树形、数组、字符串"
description varchar(200)

resource_action
-
id bigint pk
resource_id bigint fk - resource.id
name varchar(50)
description varchar(50)

resource_item
-
id bigint pk
name varchar(50)
code varchar(50)
resource_id bigint fk - resource.id
descption varchar(200)

policy
-
id bigint pk
name varchar(50)
descrition varchar(200)

policy_resource
-
id bigint pk
policy_id bigint fk - policy.id
permission_space_id bigint fk - permission_space.id
resource_id bigint fk - resource.id 
type tinyint 

policy_resource_item
-
id bigint 
policy_id bigint fk - policy.id
policy_resource_id bigint fk - policy_resource.id
resouce_item_id bigint fk - resource_item.id
resource_item_actions varchar(100)

policy_resource_condition
-
id bigint 
policy_id bigint fk - policy.id
policy_resource_id bigint fk - policy_resource.id
conditions varchar(200)

policy_auth
-
id bigint pk
name varchar(50)
policy_id bigint fk - policy.id
target_type tinyint comment "用户、角色、部门"
target_id bigint  fk - role.id
本文由作者按照 CC BY 4.0 进行授权