Don't allow sysadmin to delete himself
This commit is contained in:
parent
1f0d6ad92a
commit
08997d682c
@ -302,6 +302,10 @@ public class UserController extends BaseController {
|
||||
UserId userId = new UserId(toUUID(strUserId));
|
||||
User user = checkUserId(userId, Operation.DELETE);
|
||||
|
||||
if (user.getAuthority() == Authority.SYS_ADMIN && getCurrentUser().getId().equals(userId)) {
|
||||
throw new ThingsboardException("Sysadmin is not allowed to delete himself", ThingsboardErrorCode.PERMISSION_DENIED);
|
||||
}
|
||||
|
||||
List<EdgeId> relatedEdgeIds = findRelatedEdgeIds(getTenantId(), userId);
|
||||
|
||||
userService.deleteUser(getCurrentUser().getTenantId(), userId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user