Merge branch 'RED-6659' into 'main'

RED-6659 - Update KNECON_ADMIN rank & add error handling for acces denied

See merge request fforesight/tenant-user-management-service!85
This commit is contained in:
Ali Oezyetimoglu 2024-02-08 11:24:34 +01:00
commit af16b4db01
4 changed files with 11 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package com.knecon.fforesight.tenantusermanagement.controller;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@ -32,7 +33,6 @@ public class ControllerAdvice {
return new ResponseEntity<>(new ErrorMessage(e.getMessage()), HttpStatus.FORBIDDEN);
}
@ExceptionHandler(ResponseStatusException.class)
public ResponseEntity<ErrorMessage> handleResponseStatusException(ResponseStatusException e) {
@ -45,4 +45,11 @@ public class ControllerAdvice {
return new ResponseEntity<>(new ErrorMessage(e.getMessage()), HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(AccessDeniedException.class)
public ResponseEntity<ErrorMessage> handleAccessDeniedException(AccessDeniedException e) {
return new ResponseEntity<>(new ErrorMessage(e.getMessage()), HttpStatus.FORBIDDEN);
}
}

View File

@ -32,7 +32,7 @@ fforesight:
- 'fforesight-download-file'
- name: KNECON_ADMIN
set-by-default: false
rank: 500
rank: 1000
permissions:
- "red-read-license"
- "red-update-license"

View File

@ -21,7 +21,7 @@ fforesight:
roles:
- name: KNECON_ADMIN
set-by-default: false
rank: 500
rank: 1000
permissions: [ "red-read-license", "red-update-license","fforesight-get-tenants", "fforesight-create-tenant", "fforesight-update-tenant", "fforesight-delete-tenant","fforesight-read-users", "fforesight-read-all-users", "fforesight-write-users","fforesight-read-smtp-configuration", "fforesight-write-smtp-configuration","red-unarchive-dossier" ]
- name: RED_USER
set-by-default: true

View File

@ -47,7 +47,7 @@ fforesight:
permissions: [ "red-add-update-dossier", "red-archived-dossier", "red-delete-dossier", "red-write-dossier-attributes" ]
- name: KNECON_ADMIN
set-by-default: false
rank: 500
rank: 1000
permissions: ["red-read-license", "red-update-license","fforesight-get-tenants", "fforesight-create-tenant", "fforesight-update-tenant", "fforesight-delete-tenant","fforesight-read-users", "fforesight-read-all-users", "fforesight-write-users","fforesight-read-smtp-configuration", "fforesight-write-smtp-configuration","red-unarchive-dossier"]
- name: RED_USER_ADMIN
set-by-default: false