import request from "@/utils/request";
import constant from "@/utils/constant";

// 查询所有用户信息
const getUserList = (params) => {
    params['serviceId'] = constant.serviceId;
    return request.postForm(constant.oauthProxy + '/user/getAllUser', params)
}
// 查询当前系统普通角色
const getRoleList = (params) => {
    params['serviceId'] = constant.serviceId;
    return request.postForm(constant.oauthProxy + '/role/getRoleByServiceId', params);
}
// 查询当前系统所有权限
const getAuthList = (params) => {
    params['serviceId'] = constant.serviceId;
    return request.postForm(constant.oauthProxy + '/permission/getPermissionTreeByServiceId', params);
}
// 更新当前角色权限
const updateRoleAuth = (params) => {
    params['serviceId'] = constant.serviceId;
    return request.postForm(constant.oauthProxy + '/role/updateRolePermission', params);
}

// 修改用户角色
const updateUserRole = (params) => {
    params['serviceId'] = constant.serviceId;
    return request.postForm(constant.oauthProxy + '/user/updateUserRoles', params);
}

export default {
    getUserList,
    getRoleList,
    getAuthList,
    updateRoleAuth,
    updateUserRole,
}