@@ -8,10 +8,7 @@ import com.tuoheng.admin.service.third.oidc.OidcService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* oidc平台回调前端控制器 | |||
@@ -54,4 +51,24 @@ public class OidcCallbackController { | |||
log.info("被oidc调用,删除租户:{}", JSONObject.toJSONString(request)); | |||
return oidcService.deletedTenant(request); | |||
} | |||
/** | |||
* 查询所有可用的角色 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/getRoleList") | |||
public JsonResult getRoleList() { | |||
return oidcService.getRoleList(); | |||
} | |||
/** | |||
* 查询角色对应的菜单 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/getMenuList/{roleId}") | |||
public JsonResult getMenuList(@PathVariable("roleId") Integer roleId) { | |||
return oidcService.getMenuList(roleId); | |||
} | |||
} |
@@ -28,4 +28,6 @@ public interface IRoleService { | |||
JsonResult savePermission(RoleMenuDto roleMenuDto); | |||
JsonResult roleToTenant(Integer[] ids); | |||
JsonResult getRoles(); | |||
} |
@@ -344,6 +344,14 @@ public class RoleServiceImpl implements IRoleService { | |||
} | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
public JsonResult getRoles() { | |||
List<Role> roles = roleMapper.selectList(Wrappers.<Role>lambdaQuery() | |||
.eq(Role::getMark, MarkEnum.VALID.getCode()).eq(Role::getStatus, 1)); | |||
return JsonResult.success(roles); | |||
} | |||
} |
@@ -20,4 +20,8 @@ public interface OidcService { | |||
JsonResult editTenant(EditOidcTenantRequest request); | |||
JsonResult deletedTenant(DeletedOidcTenantRequest request); | |||
JsonResult getRoleList(); | |||
JsonResult getMenuList(Integer roleId); | |||
} |
@@ -1,10 +1,13 @@ | |||
package com.tuoheng.admin.service.third.oidc; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.tuoheng.admin.entity.Tenant; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.query.RoleClientQuery; | |||
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest; | |||
import com.tuoheng.admin.request.third.oidc.DeletedOidcTenantRequest; | |||
import com.tuoheng.admin.request.third.oidc.EditOidcTenantRequest; | |||
import com.tuoheng.admin.service.role.IRoleService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -32,6 +35,10 @@ public class OidcServiceImpl implements OidcService { | |||
@Autowired | |||
private DeletedOidcTenantService deletedOidcTenantService; | |||
@Autowired | |||
private IRoleService roleService; | |||
public JsonResult addUser(User user, String password, Tenant tenant) { | |||
return addOidcUserService.add(user, password, tenant); | |||
} | |||
@@ -58,4 +65,30 @@ public class OidcServiceImpl implements OidcService { | |||
public JsonResult deletedTenant(DeletedOidcTenantRequest request) { | |||
return deletedOidcTenantService.deletedTenant(request); | |||
} | |||
/** | |||
* 租户获取可用的角色 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getRoleList() { | |||
JsonResult jsonResult = roleService.getRoles(); | |||
return jsonResult; | |||
} | |||
/** | |||
* 获取角色对应的菜单 | |||
* | |||
* @param roleId | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getMenuList(Integer roleId) { | |||
RoleClientQuery query = new RoleClientQuery(); | |||
query.setRoleId(roleId); | |||
return roleService.getMenuList(query); | |||
} | |||
} |