+ GetRolesUserList

This commit is contained in:
gazebo
2019-09-11 11:04:29 +08:00
parent f1fbcf6366
commit 86fc32cf2e
2 changed files with 44 additions and 0 deletions

View File

@@ -132,6 +132,37 @@ func (c *User2Controller) GetRoleUserList() {
})
}
// @Title 批量得到角色包括的用户列表
// @Description 批量得到角色包括的用户列表
// @Param token header string true "认证token"
// @Param roleNames query string true "角色名"
// @Param storeIDs query string false "门店ID如果是全局角色不用填"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetRolesUserList [get]
func (c *User2Controller) GetRolesUserList() {
c.callGetRolesUserList(func(params *tUser2GetRolesUserListParams) (retVal interface{}, errCode string, err error) {
var roleNames []string
var storeIDs []int
if err = jxutils.Strings2Objs(params.RoleNames, &roleNames, params.StoreIDs, &storeIDs); err == nil {
var roleList []*authz.RoleInfo
for _, roleName := range roleNames {
if len(storeIDs) == 0 {
roleList = append(roleList, autils.NewRole(roleName, 0))
} else {
if roleName == authz.StoreRoleBoss {
for _, storeID := range storeIDs {
roleList = append(roleList, autils.NewRole(roleName, storeID))
}
}
}
}
retVal, err = cms.GetRolesUserList(params.Ctx, roleList)
}
return retVal, "", err
})
}
// @Title 给指定用户添加角色列表
// @Description 给指定用户添加角色列表
// @Param token header string true "认证token"