作者 yangfu

角色权限修改

... ... @@ -388,6 +388,7 @@ func (svr AuthService) OrgSwitch(switchOrgCommand *command.SwitchOrgCommand) (in
switchOrgCommand.Operator)
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
UserId: int(userId),
OrgId: switchOrgCommand.OrgId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -20,6 +20,8 @@ type RoleListQuery struct {
OrgName string `json:"orgName"`
RoleType int `json:"roleType"`
OrgIds []int64 `json:"inOrgIds"` //当前用户关联的组织ID列表
}
func (roleListQuery *RoleListQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -88,14 +88,18 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int
func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleListQuery.Operator)
roleList, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
req := allied_creation_user.ReqRoleSearch{
Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize,
Limit: roleListQuery.PageSize,
OrgName: roleListQuery.OrgName,
MatchRoleName: roleListQuery.RoleName,
InOrgIds: roleListQuery.Operator.OrgIds,
RoleType: roleListQuery.RoleType,
})
}
if len(roleListQuery.OrgIds) > 0 {
req.InOrgIds = roleListQuery.OrgIds
}
roleList, err := creationUserGateway.RoleSearch(req)
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ...
... ... @@ -400,7 +400,7 @@ func (gateway HttplibAlliedCreationUser) UserUpdateBaseInfo(param ReqUserUpdateB
//UserUpdateBaseInfo 返回用户有权限的菜单
func (gateway HttplibAlliedCreationUser) UserAccessMenus(param ReqUserAccessMenus) (*DataUserAccessMenus, error) {
url := fmt.Sprintf("%s%s%d%s", gateway.baseUrL, "/user/", param.UserId, "/access-menus")
url += fmt.Sprintf("?menuCategory=%v&&allDisableMenu=%v", param.MenuCategory, param.ALLDisableMenu)
url += fmt.Sprintf("?menuCategory=%v&&allDisableMenu=%v&&orgId=%v", param.MenuCategory, param.ALLDisableMenu, param.OrgId)
method := "get"
req := gateway.CreateRequest(url, method)
//TODO traceID
... ...