@Test void testDontInitialize() { when(mockRootResource.hasMetadata(eq(PreferAccessControl))).thenReturn(true); assertDoesNotThrow(() -> testService.initialize()); verify(mockRootResource, never()).stream(PreferUserManaged); }
@PostConstruct public void initialize() { if (getConfig().getOptionalValue(CONFIG_WEBAC_INITIALIZE_ROOT_ACL, Boolean.class).orElse(Boolean.TRUE)) { try (final Dataset dataset = generateDefaultRootAuthorizationsDataset(defaultAuthResourceLocation)) { this.resourceService.get(root).thenCompose(res -> initialize(res, dataset)) .exceptionally(err -> { LOGGER.warn("Unable to auto-initialize Trellis: {}. See DEBUG log for more info", err.getMessage()); LOGGER.debug("Error auto-initializing Trellis", err); return null; }).toCompletableFuture().join(); } catch (final Exception ex) { throw new TrellisRuntimeException("Error initializing Trellis ACL", ex); } } }
WebAcService { @PostConstruct public void initialize() { if (getConfig().getOptionalValue(CONFIG_WEBAC_INITIALIZE_ROOT_ACL, Boolean.class).orElse(Boolean.TRUE)) { try (final Dataset dataset = generateDefaultRootAuthorizationsDataset(defaultAuthResourceLocation)) { this.resourceService.get(root).thenCompose(res -> initialize(res, dataset)) .exceptionally(err -> { LOGGER.warn("Unable to auto-initialize Trellis: {}. See DEBUG log for more info", err.getMessage()); LOGGER.debug("Error auto-initializing Trellis", err); return null; }).toCompletableFuture().join(); } catch (final Exception ex) { throw new TrellisRuntimeException("Error initializing Trellis ACL", ex); } } } }
WebAcService { @PostConstruct public void initialize() { if (getConfig().getOptionalValue(CONFIG_WEBAC_INITIALIZE_ROOT_ACL, Boolean.class).orElse(Boolean.TRUE)) { try (final Dataset dataset = generateDefaultRootAuthorizationsDataset(defaultAuthResourceLocation)) { this.resourceService.get(root).thenCompose(res -> initialize(res, dataset)) .exceptionally(err -> { LOGGER.warn("Unable to auto-initialize Trellis: {}. See DEBUG log for more info", err.getMessage()); LOGGER.debug("Error auto-initializing Trellis", err); return null; }).toCompletableFuture().join(); } catch (final Exception ex) { throw new TrellisRuntimeException("Error initializing Trellis ACL", ex); } } } WebAcService(); @Inject  WebAcService(final ResourceService resourceService,
            @TrellisAuthorizationCache final CacheService<String, AuthorizedModes> cache); private  WebAcService(final ResourceService resourceService, final CacheService<String, AuthorizedModes> cache,
            final Config config);  WebAcService(final ResourceService resourceService, final CacheService<String, AuthorizedModes> cache,
            final boolean checkMembershipResources, final String defaultAuthResourceLocation); }
WebAcService { @PostConstruct public void initialize() { if (getConfig().getOptionalValue(CONFIG_WEBAC_INITIALIZE_ROOT_ACL, Boolean.class).orElse(Boolean.TRUE)) { try (final Dataset dataset = generateDefaultRootAuthorizationsDataset(defaultAuthResourceLocation)) { this.resourceService.get(root).thenCompose(res -> initialize(res, dataset)) .exceptionally(err -> { LOGGER.warn("Unable to auto-initialize Trellis: {}. See DEBUG log for more info", err.getMessage()); LOGGER.debug("Error auto-initializing Trellis", err); return null; }).toCompletableFuture().join(); } catch (final Exception ex) { throw new TrellisRuntimeException("Error initializing Trellis ACL", ex); } } } WebAcService(); @Inject  WebAcService(final ResourceService resourceService,
            @TrellisAuthorizationCache final CacheService<String, AuthorizedModes> cache); private  WebAcService(final ResourceService resourceService, final CacheService<String, AuthorizedModes> cache,
            final Config config);  WebAcService(final ResourceService resourceService, final CacheService<String, AuthorizedModes> cache,
            final boolean checkMembershipResources, final String defaultAuthResourceLocation); @PostConstruct void initialize(); Set<IRI> getAccessModes(final IRI identifier, final Session session); AuthorizedModes getAuthorizedModes(final IRI identifier, final Session session); static String generateCacheKey(final IRI identifier, final IRI agent); }
WebAcService { @PostConstruct public void initialize() { if (getConfig().getOptionalValue(CONFIG_WEBAC_INITIALIZE_ROOT_ACL, Boolean.class).orElse(Boolean.TRUE)) { try (final Dataset dataset = generateDefaultRootAuthorizationsDataset(defaultAuthResourceLocation)) { this.resourceService.get(root).thenCompose(res -> initialize(res, dataset)) .exceptionally(err -> { LOGGER.warn("Unable to auto-initialize Trellis: {}. See DEBUG log for more info", err.getMessage()); LOGGER.debug("Error auto-initializing Trellis", err); return null; }).toCompletableFuture().join(); } catch (final Exception ex) { throw new TrellisRuntimeException("Error initializing Trellis ACL", ex); } } } WebAcService(); @Inject  WebAcService(final ResourceService resourceService,
            @TrellisAuthorizationCache final CacheService<String, AuthorizedModes> cache); private  WebAcService(final ResourceService resourceService, final CacheService<String, AuthorizedModes> cache,
            final Config config);  WebAcService(final ResourceService resourceService, final CacheService<String, AuthorizedModes> cache,
            final boolean checkMembershipResources, final String defaultAuthResourceLocation); @PostConstruct void initialize(); Set<IRI> getAccessModes(final IRI identifier, final Session session); AuthorizedModes getAuthorizedModes(final IRI identifier, final Session session); static String generateCacheKey(final IRI identifier, final IRI agent); static final String CONFIG_WEBAC_MEMBERSHIP_CHECK; static final String CONFIG_WEBAC_DEFAULT_ACL_LOCATION; static final String CONFIG_WEBAC_INITIALIZE_ROOT_ACL; static final String DEFAULT_ACL_LOCATION; }