remove unnecessary check

Signed-off-by: MiniDigger <admin@benndorf.dev>
This commit is contained in:
MiniDigger 2022-01-08 20:21:40 +01:00
parent 23d5e953c2
commit a774a8acdd

View File

@ -149,12 +149,10 @@ public class OrganizationController extends HangarComponent {
@LoggedIn
@GetMapping(path = "/{user}/userOrganizationsVisibility", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Boolean>> getUserOrganizationMembershipVisibility(@PathVariable String user) {
Optional<HangarPrincipal> principal = getOptionalHangarPrincipal();
if (principal.isPresent()) {
if (principal.get().getName().equals(user) || principal.get().isAllowedGlobal(Permission.SeeHidden)) {
HangarPrincipal principal = getHangarPrincipal();
if (principal.getName().equals(user) || principal.isAllowedGlobal(Permission.SeeHidden)) {
return ResponseEntity.ok(memberService.getUserOrganizationMembershipVisibility(user));
}
}
throw new HangarApiException(HttpStatus.BAD_REQUEST);
}