超管判断
This commit is contained in:
@@ -5,6 +5,7 @@ import com.yunhai.bschclassmanage.utils.UserContext;
|
|||||||
import com.yunhai.bschclassmanage.config.Config;
|
import com.yunhai.bschclassmanage.config.Config;
|
||||||
import com.yunhai.platform.openapi.client.YschBaseOpenApi;
|
import com.yunhai.platform.openapi.client.YschBaseOpenApi;
|
||||||
import com.yunhai.platform.utils.model.BoaModule;
|
import com.yunhai.platform.utils.model.BoaModule;
|
||||||
|
import com.yunhai.platform.utils.model.BoaUser;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -21,6 +22,16 @@ import java.util.List;
|
|||||||
@CrossOrigin(originPatterns = {"*"}, allowCredentials = "true")
|
@CrossOrigin(originPatterns = {"*"}, allowCredentials = "true")
|
||||||
public class LoginUserController {
|
public class LoginUserController {
|
||||||
|
|
||||||
|
@GetMapping("getUserMod")
|
||||||
|
public List<BoaModule> getUserMod() {
|
||||||
|
return YschBaseOpenApi.getUserModule(UserContext.getUserId(),UserContext.getSchId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("getUserInfo")
|
||||||
|
public BoaUser getUserInfo(BoaUser authUserWithDept) {
|
||||||
|
return authUserWithDept;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("Logout")
|
@GetMapping("Logout")
|
||||||
protected void logout(HttpServletRequest request) {
|
protected void logout(HttpServletRequest request) {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class SchsystemController {
|
|||||||
|
|
||||||
Integer roleId = UserContext.getRoleId();
|
Integer roleId = UserContext.getRoleId();
|
||||||
boolean isSuperAdmin = UserType.SUPER_ADMINISTRATOR.getId().equals(UserContext.getType());
|
boolean isSuperAdmin = UserType.SUPER_ADMINISTRATOR.getId().equals(UserContext.getType());
|
||||||
boolean isAreaAdmin = UserRole.AREAADMIN.getValue().equals(roleId);
|
boolean isAreaAdmin = !isSuperAdmin && UserRole.AREAADMIN.getValue().equals(roleId);
|
||||||
|
|
||||||
if (!isSuperAdmin && !isAreaAdmin) {
|
if (!isSuperAdmin && !isAreaAdmin) {
|
||||||
throw new DException("无权操作,仅超级管理员或学校管理员可设置学制");
|
throw new DException("无权操作,仅超级管理员或学校管理员可设置学制");
|
||||||
@@ -82,7 +82,7 @@ public class SchsystemController {
|
|||||||
// 2. 角色权限校验
|
// 2. 角色权限校验
|
||||||
Integer roleId = user.getRoleId();
|
Integer roleId = user.getRoleId();
|
||||||
boolean isSuperAdmin = UserType.SUPER_ADMINISTRATOR.getId().equals(UserContext.getType());
|
boolean isSuperAdmin = UserType.SUPER_ADMINISTRATOR.getId().equals(UserContext.getType());
|
||||||
boolean isAreaAdmin = UserRole.AREAADMIN.getValue().equals(roleId);
|
boolean isAreaAdmin =!isSuperAdmin && UserRole.AREAADMIN.getValue().equals(roleId);
|
||||||
|
|
||||||
if (!isSuperAdmin && !isAreaAdmin) {
|
if (!isSuperAdmin && !isAreaAdmin) {
|
||||||
throw new DException("无权操作,仅超级管理员或学校管理员可设置学制");
|
throw new DException("无权操作,仅超级管理员或学校管理员可设置学制");
|
||||||
|
|||||||
Reference in New Issue
Block a user