mirror of
https://github.com/dqjdda/Aurora.git
synced 2018-11-06 05:33:29 +00:00
修复删除角色和删除权限失败时,不提示的bug
This commit is contained in:
@@ -73,10 +73,12 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
|
||||
@Override
|
||||
public void delete(Permission permission) {
|
||||
if(permission.getRoles() != null && permission.getRoles().size()!=0){
|
||||
throw new AuroraException(HttpStatus.HTTP_BAD_REQUEST,"暂不支持删除使用中的权限,请先与角色解绑");
|
||||
try {
|
||||
permissionRepo.delete(permission);
|
||||
}catch (Exception e){
|
||||
throw new AuroraException(HttpStatus.HTTP_BAD_REQUEST,"删除失败,请检查权限是否被使用");
|
||||
}
|
||||
permissionRepo.delete(permission);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -96,10 +96,11 @@ public class RoleServiceImpl implements RoleService {
|
||||
|
||||
@Override
|
||||
public void delete(Role role) {
|
||||
if(role.getUsers() != null && role.getUsers().size() != 0){
|
||||
throw new AuroraException(400,"角色使用中,请先解绑用户");
|
||||
try {
|
||||
roleRepo.delete(role);
|
||||
}catch (Exception e){
|
||||
throw new AuroraException(HttpStatus.HTTP_INTERNAL_ERROR,"删除失败,请检查角色是否被使用");
|
||||
}
|
||||
roleRepo.delete(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user