void checkWorkspacePermission( String workspaceName, String... actions ) throws AccessDeniedException { checkPermission(workspaceName, (PathSupplier)null, actions); }
@Override public boolean canRead( CachedNode node ) { if (node == null) { return false; } Path path = getPath(node); try { session.checkPermission(path, ModeShapePermissions.READ); return true; } catch (AccessDeniedException ade) { LOGGER.debug("READ access denied on '{0}'", path); return false; } }
void checkPermission( PathSupplier pathSupplier, String... actions ) throws AccessDeniedException { checkPermission(this.workspace().getName(), pathSupplier, actions); }
void checkPermission( CachedNode node, NodeCache cache, String... actions ) throws AccessDeniedException { checkPermission(this.workspace().getName(), pathSupplierFor(node, cache), actions); }
void checkPermission( CachedNode node, NodeCache cache, String... actions ) throws AccessDeniedException { checkPermission(this.workspace().getName(), pathSupplierFor(node, cache), actions); }
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowCheckPermissionWithNoPath() throws Exception { session.checkPermission((String)null, "read"); }
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowCheckPermissionWithEmptyActions() throws Exception { session.checkPermission("/", ""); }
@Override public void reindex() throws RepositoryException { // First check permissions ... session.checkPermission(workspaceName, Path.ROOT_PATH, ModeShapePermissions.INDEX_WORKSPACE); // Then reindex ... repository().runningState().queryManager().reindexContent(this); }
@Override public Future<Boolean> reindexAsync() throws RepositoryException { // First check permissions ... session.checkPermission(workspaceName, Path.ROOT_PATH, ModeShapePermissions.INDEX_WORKSPACE); // Then reindex ... return repository().runningState().queryManager().reindexContentAsync(this); }
@Override public Problems backupRepository( File backupDirectory, BackupOptions backupOptions ) throws RepositoryException { session().checkPermission(Path.ROOT_PATH, ModeShapePermissions.BACKUP); return repository().runningState().backupService().backupRepository(backupDirectory, backupOptions); }
@Override public Problems backupRepository( File backupDirectory, BackupOptions backupOptions ) throws RepositoryException { session().checkPermission(Path.ROOT_PATH, ModeShapePermissions.BACKUP); return repository().runningState().backupService().backupRepository(backupDirectory, backupOptions); }
@Override public Problems restoreRepository( File backupDirectory, RestoreOptions options ) throws RepositoryException { session().checkPermission(Path.ROOT_PATH, ModeShapePermissions.RESTORE); return repository().runningState().backupService().restoreRepository(repository(), backupDirectory, options); }
@Override public Future<Boolean> reindexAsync( String pathStr ) throws RepositoryException { try { // First check permissions ... Path path = session.pathFactory().create(pathStr); session.checkPermission(workspaceName, path, ModeShapePermissions.INDEX_WORKSPACE); // Then reindex ... return repository().runningState().queryManager().reindexContentAsync(this, path, Integer.MAX_VALUE); } catch (ValueFormatException e) { throw new RepositoryException(e.getMessage()); } }
@Override public void reindex( String pathStr ) throws RepositoryException { try { // First check permissions ... Path path = session.pathFactory().create(pathStr); session.checkPermission(workspaceName, path, ModeShapePermissions.INDEX_WORKSPACE); // Then reindex ... repository().runningState().queryManager().reindexContent(this, path, Integer.MAX_VALUE); } catch (ValueFormatException e) { throw new RepositoryException(e.getMessage()); } }
@Override public void reindex( String pathStr ) throws RepositoryException { try { // First check permissions ... Path path = session.pathFactory().create(pathStr); session.checkPermission(workspaceName, path, ModeShapePermissions.INDEX_WORKSPACE); // Then reindex ... repository().runningState().queryManager().reindexContent(this, path, Integer.MAX_VALUE); } catch (ValueFormatException e) { throw new RepositoryException(e.getMessage()); } }
@Override public Future<Boolean> reindexAsync( String pathStr ) throws RepositoryException { try { // First check permissions ... Path path = session.pathFactory().create(pathStr); session.checkPermission(workspaceName, path, ModeShapePermissions.INDEX_WORKSPACE); // Then reindex ... return repository().runningState().queryManager().reindexContentAsync(this, path, Integer.MAX_VALUE); } catch (ValueFormatException e) { throw new RepositoryException(e.getMessage()); } }
@Override public void reindexSince( long timestamp ) throws RepositoryException { // First check permissions ... session.checkPermission(workspaceName, Path.ROOT_PATH, ModeShapePermissions.INDEX_WORKSPACE); // then if the journal is available JcrRepository.RunningState runningState = repository().runningState(); if (runningState.journal() == null) { throw new RepositoryException(JcrI18n.cannotReindexJournalNotEnabled.text(timestamp, repository().getName())); } runningState.queryManager().reindexSince(this, timestamp); }
@Override public Future<Boolean> reindexSinceAsync( long timestamp ) throws RepositoryException { // First check permissions ... session.checkPermission(workspaceName, Path.ROOT_PATH, ModeShapePermissions.INDEX_WORKSPACE); // then if the journal is available JcrRepository.RunningState runningState = repository().runningState(); if (runningState.journal() == null) { throw new RepositoryException(JcrI18n.cannotReindexJournalNotEnabled.text(timestamp, repository().getName())); } return runningState.queryManager().reindexSinceAsync(this, timestamp); }
@Override public Future<Boolean> reindexSinceAsync( long timestamp ) throws RepositoryException { // First check permissions ... session.checkPermission(workspaceName, Path.ROOT_PATH, ModeShapePermissions.INDEX_WORKSPACE); // then if the journal is available JcrRepository.RunningState runningState = repository().runningState(); if (runningState.journal() == null) { throw new RepositoryException(JcrI18n.cannotReindexJournalNotEnabled.text(timestamp, repository().getName())); } return runningState.queryManager().reindexSinceAsync(this, timestamp); }
@Override public void reindexSince( long timestamp ) throws RepositoryException { // First check permissions ... session.checkPermission(workspaceName, Path.ROOT_PATH, ModeShapePermissions.INDEX_WORKSPACE); // then if the journal is available JcrRepository.RunningState runningState = repository().runningState(); if (runningState.journal() == null) { throw new RepositoryException(JcrI18n.cannotReindexJournalNotEnabled.text(timestamp, repository().getName())); } runningState.queryManager().reindexSince(this, timestamp); }