作者 yangfu

角色权限修改

@@ -388,6 +388,7 @@ func (svr AuthService) OrgSwitch(switchOrgCommand *command.SwitchOrgCommand) (in @@ -388,6 +388,7 @@ func (svr AuthService) OrgSwitch(switchOrgCommand *command.SwitchOrgCommand) (in
388 switchOrgCommand.Operator) 388 switchOrgCommand.Operator)
389 resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{ 389 resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
390 UserId: int(userId), 390 UserId: int(userId),
  391 + OrgId: switchOrgCommand.OrgId,
391 }) 392 })
392 if err != nil { 393 if err != nil {
393 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 394 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -20,6 +20,8 @@ type RoleListQuery struct { @@ -20,6 +20,8 @@ type RoleListQuery struct {
20 OrgName string `json:"orgName"` 20 OrgName string `json:"orgName"`
21 21
22 RoleType int `json:"roleType"` 22 RoleType int `json:"roleType"`
  23 +
  24 + OrgIds []int64 `json:"inOrgIds"` //当前用户关联的组织ID列表
23 } 25 }
24 26
25 func (roleListQuery *RoleListQuery) Valid(validation *validation.Validation) { 27 func (roleListQuery *RoleListQuery) Valid(validation *validation.Validation) {
@@ -88,14 +88,18 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int @@ -88,14 +88,18 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int
88 func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) { 88 func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) {
89 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 89 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
90 roleListQuery.Operator) 90 roleListQuery.Operator)
91 - roleList, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ 91 + req := allied_creation_user.ReqRoleSearch{
92 Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize, 92 Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize,
93 Limit: roleListQuery.PageSize, 93 Limit: roleListQuery.PageSize,
94 OrgName: roleListQuery.OrgName, 94 OrgName: roleListQuery.OrgName,
95 MatchRoleName: roleListQuery.RoleName, 95 MatchRoleName: roleListQuery.RoleName,
96 InOrgIds: roleListQuery.Operator.OrgIds, 96 InOrgIds: roleListQuery.Operator.OrgIds,
97 RoleType: roleListQuery.RoleType, 97 RoleType: roleListQuery.RoleType,
98 - }) 98 + }
  99 + if len(roleListQuery.OrgIds) > 0 {
  100 + req.InOrgIds = roleListQuery.OrgIds
  101 + }
  102 + roleList, err := creationUserGateway.RoleSearch(req)
99 if err != nil { 103 if err != nil {
100 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 104 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
101 } 105 }
@@ -400,7 +400,7 @@ func (gateway HttplibAlliedCreationUser) UserUpdateBaseInfo(param ReqUserUpdateB @@ -400,7 +400,7 @@ func (gateway HttplibAlliedCreationUser) UserUpdateBaseInfo(param ReqUserUpdateB
400 //UserUpdateBaseInfo 返回用户有权限的菜单 400 //UserUpdateBaseInfo 返回用户有权限的菜单
401 func (gateway HttplibAlliedCreationUser) UserAccessMenus(param ReqUserAccessMenus) (*DataUserAccessMenus, error) { 401 func (gateway HttplibAlliedCreationUser) UserAccessMenus(param ReqUserAccessMenus) (*DataUserAccessMenus, error) {
402 url := fmt.Sprintf("%s%s%d%s", gateway.baseUrL, "/user/", param.UserId, "/access-menus") 402 url := fmt.Sprintf("%s%s%d%s", gateway.baseUrL, "/user/", param.UserId, "/access-menus")
403 - url += fmt.Sprintf("?menuCategory=%v&&allDisableMenu=%v", param.MenuCategory, param.ALLDisableMenu) 403 + url += fmt.Sprintf("?menuCategory=%v&&allDisableMenu=%v&&orgId=%v", param.MenuCategory, param.ALLDisableMenu, param.OrgId)
404 method := "get" 404 method := "get"
405 req := gateway.CreateRequest(url, method) 405 req := gateway.CreateRequest(url, method)
406 //TODO traceID 406 //TODO traceID