正在显示
4 个修改的文件
包含
282 行增加
和
19 行删除
@@ -14,7 +14,7 @@ type AuthController struct { | @@ -14,7 +14,7 @@ type AuthController struct { | ||
14 | 14 | ||
15 | //URLMapping 实现ControllerInterface中的URLMapping | 15 | //URLMapping 实现ControllerInterface中的URLMapping |
16 | func (c *AuthController) URLMapping() { | 16 | func (c *AuthController) URLMapping() { |
17 | - | 17 | + c.Mapping("RefreshToken", c.RefreshToken) |
18 | } | 18 | } |
19 | 19 | ||
20 | // RefreshToken .... | 20 | // RefreshToken .... |
1 | package routers | 1 | package routers |
2 | 2 | ||
3 | -// type PermissionBase struct { | ||
4 | -// Check int8 `json:"check"` | ||
5 | -// } | 3 | +//PermissionBase 路由对应的权限 |
4 | +type PermissionBase struct { | ||
5 | + CodeName string //模块标识 | ||
6 | + ActionName string | ||
7 | + MethodMap map[string]func() | ||
8 | +} | ||
9 | + | ||
10 | +func (p PermissionBase) ValidMapping(actionName string, fn func()) { | ||
11 | + p.MethodMap[actionName] = fn | ||
12 | +} | ||
6 | 13 | ||
7 | -//职位管理相关 | 14 | +var routerPermission = map[string]PermissionBase{ |
15 | + "/v1/department/list": PermissionBase{CodeName: "OPPMG_DEPARTMENT", ActionName: "check"}, | ||
16 | + "/v1/department/add": PermissionBase{CodeName: "OPPMG_DEPARTMENT", ActionName: "add"}, | ||
17 | + "/v1/department/edit": PermissionBase{CodeName: "OPPMG_DEPARTMENT", ActionName: "edit"}, | ||
18 | + "/v1/department/delete": PermissionBase{CodeName: "OPPMG_DEPARTMENT", ActionName: "delete"}, | ||
19 | +} | ||
20 | + | ||
21 | +//PermissionWithPosition 职位管理相关 | ||
8 | type PermissionWithPosition struct { | 22 | type PermissionWithPosition struct { |
9 | - Check int8 `json:"check"` | 23 | + PermissionBase |
10 | } | 24 | } |
11 | 25 | ||
12 | -func (c PermissionWithPosition) Code() string { | ||
13 | - return "OPPMG_POSITION" | 26 | +//GetCode 模块标识 |
27 | +func (c *PermissionWithPosition) GetCodeName() string { | ||
28 | + return "OPPMG_DEPARTMENT" | ||
14 | } | 29 | } |
15 | 30 | ||
16 | -//部门管理相关 | ||
17 | -type PermissionWithDepart struct { | ||
18 | - Check int8 `json:"check"` | 31 | +//Valid 权限校验 |
32 | +func (c PermissionWithPosition) Valid(userCompanyID int64) bool { | ||
33 | + return true | ||
19 | } | 34 | } |
35 | + | ||
36 | +//PermissionWithDepart 部门管理相关 | ||
37 | +// type PermissionWithDepart struct { | ||
38 | +// Check int8 `json:"check"` | ||
39 | +// } |
@@ -89,11 +89,3 @@ func init() { | @@ -89,11 +89,3 @@ func init() { | ||
89 | 89 | ||
90 | beego.SetStaticPath("/log", beego.AppConfig.String("log_filename")) | 90 | beego.SetStaticPath("/log", beego.AppConfig.String("log_filename")) |
91 | } | 91 | } |
92 | - | ||
93 | -//routerPermission 路由对应的权限 | ||
94 | -// var routerPermission = map[string]string{ | ||
95 | -// : "show", | ||
96 | -// "post:/v1/company/position": "add", | ||
97 | -// "put:/v1/company/position": "edit", | ||
98 | -// "delete:/v1/company/position": "delete", | ||
99 | -// } |
@@ -147,6 +147,61 @@ token 的响应内容 | @@ -147,6 +147,61 @@ token 的响应内容 | ||
147 | 147 | ||
148 | ## 公司部门管理 | 148 | ## 公司部门管理 |
149 | 149 | ||
150 | + | ||
151 | +### 部门列表 | ||
152 | + | ||
153 | +- 请求路径:/v1/department/list | ||
154 | +- 请求方式:post | ||
155 | +- 请求 json: | ||
156 | + | ||
157 | +```json | ||
158 | +{ | ||
159 | + | ||
160 | +} | ||
161 | +``` | ||
162 | + | ||
163 | +- 正常响应 json | ||
164 | + | ||
165 | +```json | ||
166 | +{ | ||
167 | + "code": 0, | ||
168 | + "msg": "成功", | ||
169 | + "data": { | ||
170 | + "list": [ | ||
171 | + { | ||
172 | + "id": 1, | ||
173 | + "company_id": 1, | ||
174 | + "name": "部门1", | ||
175 | + "parant_id": 0, | ||
176 | + "manages": [{ | ||
177 | + "id":1, | ||
178 | + "name":"主管" | ||
179 | + }], | ||
180 | + "member": 1 | ||
181 | + }, | ||
182 | + { | ||
183 | + "id": 2, | ||
184 | + "company_id": 1, | ||
185 | + "name": "部门1-2", | ||
186 | + "parant_id": 1, | ||
187 | + "manages": [{ | ||
188 | + "id":1, | ||
189 | + "name":"主管" | ||
190 | + }], | ||
191 | + "member": 1 | ||
192 | + } | ||
193 | + ] | ||
194 | + } | ||
195 | +} | ||
196 | +``` | ||
197 | + | ||
198 | +- 备注;无 | ||
199 | + | ||
200 | +--- | ||
201 | + | ||
202 | + | ||
203 | + | ||
204 | + | ||
150 | ### 添加部门 | 205 | ### 添加部门 |
151 | 206 | ||
152 | - 请求路径:/v1/department/add | 207 | - 请求路径:/v1/department/add |
@@ -234,6 +289,79 @@ token 的响应内容 | @@ -234,6 +289,79 @@ token 的响应内容 | ||
234 | 289 | ||
235 | ## 公司职位管理 | 290 | ## 公司职位管理 |
236 | 291 | ||
292 | + | ||
293 | +### 职位列表 | ||
294 | + | ||
295 | +- 请求路径:/v1/position/list | ||
296 | +- 请求方式:post | ||
297 | +- 请求 json: | ||
298 | + | ||
299 | +```json | ||
300 | +{ | ||
301 | + | ||
302 | +} | ||
303 | +``` | ||
304 | + | ||
305 | +- 响应 json | ||
306 | + | ||
307 | +```json | ||
308 | +{ | ||
309 | + "code": 0, | ||
310 | + "msg": "成功", | ||
311 | + "data": [ | ||
312 | + { | ||
313 | + "id": 1, | ||
314 | + "name": "董事长", | ||
315 | + "parent_id": 0 | ||
316 | + }, | ||
317 | + { | ||
318 | + "id": 2, | ||
319 | + "name": "总经理", | ||
320 | + "parent_id": 1 | ||
321 | + }, | ||
322 | + { | ||
323 | + "id": 3, | ||
324 | + "name": "副总经理", | ||
325 | + "parent_id": 2 | ||
326 | + }, | ||
327 | + { | ||
328 | + "id": 4, | ||
329 | + "name": "技术总监", | ||
330 | + "parent_id": 2 | ||
331 | + }, | ||
332 | + { | ||
333 | + "id": 5, | ||
334 | + "name": "职位a", | ||
335 | + "parent_id": 0 | ||
336 | + }, | ||
337 | + { | ||
338 | + "id": 6, | ||
339 | + "name": "职位b-1", | ||
340 | + "parent_id": 9 | ||
341 | + }, | ||
342 | + { | ||
343 | + "id": 7, | ||
344 | + "name": "职位a-2", | ||
345 | + "parent_id": 5 | ||
346 | + }, | ||
347 | + { | ||
348 | + "id": 8, | ||
349 | + "name": "职位a-1-1", | ||
350 | + "parent_id": 6 | ||
351 | + }, | ||
352 | + { | ||
353 | + "id": 9, | ||
354 | + "name": "职位b-1", | ||
355 | + "parent_id": 0 | ||
356 | + } | ||
357 | + ] | ||
358 | +} | ||
359 | +``` | ||
360 | + | ||
361 | +- 备注;无 | ||
362 | + | ||
363 | +--- | ||
364 | + | ||
237 | ### 添加职位 | 365 | ### 添加职位 |
238 | 366 | ||
239 | - 请求路径:/v1/position/add | 367 | - 请求路径:/v1/position/add |
@@ -320,6 +448,129 @@ token 的响应内容 | @@ -320,6 +448,129 @@ token 的响应内容 | ||
320 | --- | 448 | --- |
321 | 449 | ||
322 | ## 公司员工角色 | 450 | ## 公司员工角色 |
451 | +### 角色列表 | ||
452 | + | ||
453 | +- 请求路径:/v1/rbac/role/list | ||
454 | +- 请求方式:post | ||
455 | +- 请求 json: | ||
456 | + | ||
457 | +```json | ||
458 | +{ | ||
459 | + | ||
460 | +} | ||
461 | +``` | ||
462 | + | ||
463 | +- 响应 json | ||
464 | + | ||
465 | +```json | ||
466 | + | ||
467 | +{ | ||
468 | + "code": 0, | ||
469 | + "msg": "成功", | ||
470 | + "data": { | ||
471 | + "list": [ | ||
472 | + { | ||
473 | + "id": 1, | ||
474 | + "company_id": 1, | ||
475 | + "name": "部门1", | ||
476 | + "parant_id": 0, | ||
477 | + "manages": [], | ||
478 | + "members": [ | ||
479 | + { | ||
480 | + "id": 1, | ||
481 | + "name": "Jennifer Clark" | ||
482 | + } | ||
483 | + ], | ||
484 | + "member": 1 | ||
485 | + }, | ||
486 | + { | ||
487 | + "id": 2, | ||
488 | + "company_id": 1, | ||
489 | + "name": "部门1-2", | ||
490 | + "parant_id": 1, | ||
491 | + "manages": [], | ||
492 | + "members": [], | ||
493 | + "member": 1 | ||
494 | + }, | ||
495 | + { | ||
496 | + "id": 3, | ||
497 | + "company_id": 1, | ||
498 | + "name": "部门1-2-3", | ||
499 | + "parant_id": 2, | ||
500 | + "manages": [], | ||
501 | + "members": [], | ||
502 | + "member": 0 | ||
503 | + }, | ||
504 | + { | ||
505 | + "id": 4, | ||
506 | + "company_id": 1, | ||
507 | + "name": "部门1-2-4", | ||
508 | + "parant_id": 2, | ||
509 | + "manages": [], | ||
510 | + "members": [], | ||
511 | + "member": 0 | ||
512 | + }, | ||
513 | + { | ||
514 | + "id": 5, | ||
515 | + "company_id": 1, | ||
516 | + "name": "部门1-2-5", | ||
517 | + "parant_id": 3, | ||
518 | + "manages": [], | ||
519 | + "members": [], | ||
520 | + "member": 0 | ||
521 | + }, | ||
522 | + { | ||
523 | + "id": 7, | ||
524 | + "company_id": 1, | ||
525 | + "name": "部门1-2-5-7", | ||
526 | + "parant_id": 5, | ||
527 | + "manages": [], | ||
528 | + "members": [], | ||
529 | + "member": 0 | ||
530 | + }, | ||
531 | + { | ||
532 | + "id": 10, | ||
533 | + "company_id": 1, | ||
534 | + "name": "部门2", | ||
535 | + "parant_id": 0, | ||
536 | + "manages": [], | ||
537 | + "members": [], | ||
538 | + "member": 0 | ||
539 | + }, | ||
540 | + { | ||
541 | + "id": 26, | ||
542 | + "company_id": 1, | ||
543 | + "name": "部门名称1", | ||
544 | + "parant_id": 1, | ||
545 | + "manages": [ | ||
546 | + { | ||
547 | + "id": 1, | ||
548 | + "name": "Jennifer Clark" | ||
549 | + } | ||
550 | + ], | ||
551 | + "members": [], | ||
552 | + "member": 0 | ||
553 | + }, | ||
554 | + { | ||
555 | + "id": 27, | ||
556 | + "company_id": 1, | ||
557 | + "name": "部门名称1", | ||
558 | + "parant_id": 1, | ||
559 | + "manages": [], | ||
560 | + "members": [], | ||
561 | + "member": 0 | ||
562 | + } | ||
563 | + ] | ||
564 | + } | ||
565 | +} | ||
566 | +``` | ||
567 | + | ||
568 | +- 备注;无 | ||
569 | + | ||
570 | +--- | ||
571 | + | ||
572 | + | ||
573 | + | ||
323 | 574 | ||
324 | ### 添加角色 | 575 | ### 添加角色 |
325 | 576 |
-
请 注册 或 登录 后发表评论