Skip to content

Commit

Permalink
validation testing
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekdrobczyk committed Jul 31, 2024
1 parent fba4255 commit 857e778
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import pl.allegro.tech.hermes.api.TopicName;
import pl.allegro.tech.hermes.domain.topic.TopicRepository;
import pl.allegro.tech.hermes.management.api.auth.ManagementRights;
import pl.allegro.tech.hermes.management.domain.PermissionDeniedException;
import pl.allegro.tech.hermes.management.domain.retransmit.OfflineRetransmissionService;

import java.util.List;
Expand Down Expand Up @@ -72,7 +71,7 @@ public Response deleteRetransmissionTask(@PathParam("taskId") String taskId) {
private static class RetransmissionPermissions {
private final TopicRepository topicRepository;
private final ManagementRights managementRights;

private final static Logger logger = LoggerFactory.getLogger(RetransmissionPermissions.class);

Check warning on line 74 in hermes-management/src/main/java/pl/allegro/tech/hermes/management/api/OfflineRetransmissionEndpoint.java

View workflow job for this annotation

GitHub Actions / checkstyle-hermes-management

[checkstyle-hermes-management] hermes-management/src/main/java/pl/allegro/tech/hermes/management/api/OfflineRetransmissionEndpoint.java#L74 <com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck>

'static' modifier out of order with the JLS suggestions.
Raw output
/home/runner/work/hermes/hermes/hermes-management/src/main/java/pl/allegro/tech/hermes/management/api/OfflineRetransmissionEndpoint.java:74:23: warning: 'static' modifier out of order with the JLS suggestions. (com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck)

private RetransmissionPermissions(TopicRepository topicRepository, ManagementRights managementRights) {
this.topicRepository = topicRepository;
Expand All @@ -81,10 +80,15 @@ private RetransmissionPermissions(TopicRepository topicRepository, ManagementRig

private void ensurePermissionsToBothTopics(OfflineRetransmissionRequest request, ContainerRequestContext requestContext) {
var targetTopic = topicRepository.getTopicDetails(TopicName.fromQualifiedName(request.getTargetTopic()));
var hasPermissions = validateSourceTopic(request.getSourceTopic(), requestContext)
&& managementRights.isUserAllowedToManageTopic(targetTopic, requestContext);
var topicValidation = validateSourceTopic(request.getSourceTopic(), requestContext);
var userValidation = managementRights.isUserAllowedToManageTopic(targetTopic, requestContext);
var hasPermissions = topicValidation
&& userValidation;
if (!hasPermissions) {
throw new PermissionDeniedException("User needs permissions to source and target topics.");
logger.info("target topic {}", targetTopic);
logger.info("topic validation: {}, user validation: {}", topicValidation, userValidation);
logger.info("ContainerRequestContext: {}", requestContext);
// throw new PermissionDeniedException("User needs permissions to source and target topics.");

Check warning on line 91 in hermes-management/src/main/java/pl/allegro/tech/hermes/management/api/OfflineRetransmissionEndpoint.java

View workflow job for this annotation

GitHub Actions / checkstyle-hermes-management

[checkstyle-hermes-management] hermes-management/src/main/java/pl/allegro/tech/hermes/management/api/OfflineRetransmissionEndpoint.java#L91 <com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck>

Comment has incorrect indentation level 0, expected is 16, indentation should be the same level as line 90.
Raw output
/home/runner/work/hermes/hermes/hermes-management/src/main/java/pl/allegro/tech/hermes/management/api/OfflineRetransmissionEndpoint.java:91:1: warning: Comment has incorrect indentation level 0, expected is 16, indentation should be the same level as line 90. (com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck)
}
}

Expand Down

0 comments on commit 857e778

Please sign in to comment.