Class CurrentAuthorityService
java.lang.Object
de.gustavblass.fsu.fmi.roombooking.service.CurrentAuthorityService
Serves the sole purpose of determining the
ActorAuthority of the Actor who made the current web request.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckAuthorisationForActorAccess(@NonNull ActorAuthority subjectAuthority, @NonNull String errorMessage) Verifies that the current end-user has sufficient privilege to create, modify or delete anActorwith the givenActorAuthority.getActor()Determines theActorthat makes the current request.static @NonNull Optional<ActorAuthority> Determines theActorAuthorityof theActorwho made the current web request.
-
Constructor Details
-
CurrentAuthorityService
public CurrentAuthorityService()
-
-
Method Details
-
getActor
-
getHighestAuthority
Determines theActorAuthorityof theActorwho made the current web request.- Returns:
- The ActorAuthority of the current request's Actor. If the Actor has multiple authorities, the most important one will be returned, if present. Empty if none of the GrantedAuthorities matches any ActorAuthority.
-
checkAuthorisationForActorAccess
public static void checkAuthorisationForActorAccess(@NonNull @NonNull ActorAuthority subjectAuthority, @NonNull @NonNull String errorMessage) throws UnauthorisedException Verifies that the current end-user has sufficient privilege to create, modify or delete an
Actorwith the givenActorAuthority.subjectAuthorityRequired ActorAuthorityActorAuthority.IT_ADMINISTRATIONActorAuthority.IT_ADMINISTRATIONActorAuthority.FACULTY_ADMINISTRATIONActorAuthority.IT_ADMINISTRATIONeverything else ActorAuthority.FACULTY_ADMINISTRATION- Parameters:
subjectAuthority- The ActorAuthority of the user who shall be created, modified or deleted.errorMessage- Shall be used as theThrowable.getMessage().- Throws:
UnauthorisedException- If the end user making the request does not have the necessary authority to create, modify or delete any user with the given authority.
-