Skip to content

Commit

Permalink
BE: RBAC: Skip rbac checks in case of app config (#4078)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haarolean authored Aug 1, 2023
1 parent 3cde6c2 commit 77f1ec9
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
@Slf4j
public class AccessControlService {

private static final String ACCESS_DENIED = "Access denied";

@Nullable
private final InMemoryReactiveClientRegistrationRepository clientRegistrationRepository;
private final RoleBasedAccessControlProperties properties;
Expand Down Expand Up @@ -97,6 +99,17 @@ public Mono<Void> validateAccess(AccessContext context) {
return Mono.empty();
}

if (CollectionUtils.isNotEmpty(context.getApplicationConfigActions())) {
return getUser()
.doOnNext(user -> {
boolean accessGranted = isApplicationConfigAccessible(context, user);

if (!accessGranted) {
throw new AccessDeniedException(ACCESS_DENIED);
}
}).then();
}

return getUser()
.doOnNext(user -> {
boolean accessGranted =
Expand All @@ -113,7 +126,7 @@ && isAclAccessible(context, user)
&& isAuditAccessible(context, user);

if (!accessGranted) {
throw new AccessDeniedException("Access denied");
throw new AccessDeniedException(ACCESS_DENIED);
}
})
.then();
Expand Down

0 comments on commit 77f1ec9

Please sign in to comment.