Skip to content

Commit

Permalink
Extend DTR APIs for Access management
Browse files Browse the repository at this point in the history
- Code review fixes #1
  • Loading branch information
istvan-nagy-epam committed Feb 5, 2024
1 parent 4b26187 commit 6a0ce75
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,22 @@
import org.eclipse.tractusx.semantics.RegistryProperties;
import org.eclipse.tractusx.semantics.accesscontrol.api.AccessControlRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ShellAccessHandlerConfiguration {

@ConditionalOnProperty(prefix = "registry", name = "use-granular-access-control", matchIfMissing = true, havingValue = "false")
@Bean
@Autowired
public ShellAccessHandler createDefaultShellAccessHandler(final RegistryProperties registryProperties) {
return new DefaultShellAccessHandler(registryProperties);
}

@ConditionalOnProperty(prefix = "registry", name = "use-granular-access-control", havingValue = "true")
@Bean
@Autowired
public ShellAccessHandler createGranularShellAccessHandler(final RegistryProperties registryProperties, final AccessControlRuleService accessControlRuleService) {
return new GranularShellAccessHandler(registryProperties, accessControlRuleService);
}
@Bean
@Autowired
public ShellAccessHandler shellAccessHandler(
final RegistryProperties registryProperties, final AccessControlRuleService accessControlRuleService ) {
final ShellAccessHandler result;
if ( Boolean.TRUE.equals( registryProperties.getUseGranularAccessControl() ) ) {
result = new GranularShellAccessHandler( registryProperties, accessControlRuleService );
} else {
result = new DefaultShellAccessHandler( registryProperties );
}
return result;
}
}

0 comments on commit 6a0ce75

Please sign in to comment.