@Override public WorkspaceAccessLimits getAccessLimits(Authentication user, WorkspaceInfo workspace) { if (hideWorkspace(workspace)) { return new WorkspaceAccessLimits(CatalogMode.HIDE, false, false, false); } else { return super.getAccessLimits(user, workspace); } }
public WorkspaceAccessLimits getAccessLimits(Authentication user, WorkspaceInfo workspace) { boolean readable = canAccess(user, workspace, AccessMode.READ); boolean writable = canAccess(user, workspace, AccessMode.WRITE); boolean adminable = canAccess(user, workspace, AccessMode.ADMIN); CatalogMode mode = getMode(); if (readable && writable) { if (AdminRequest.get() == null) { // not admin request, read+write means full acesss return null; } } return new WorkspaceAccessLimits(mode, readable, writable, adminable); }
public WorkspaceAccessLimits getAccessLimits(Authentication user, WorkspaceInfo workspace) { boolean readable = delegate.canAccess(user, workspace, AccessMode.READ); boolean writable = delegate.canAccess(user, workspace, AccessMode.WRITE); boolean adminable = delegate.canAccess(user, workspace, AccessMode.ADMIN); CatalogMode mode = delegate.getMode(); if (readable && writable) { if (AdminRequest.get() == null) { // not admin request, read+write means full acesss return null; } } return new WorkspaceAccessLimits(mode, readable, writable, adminable); }
protected WorkspaceAccessLimits intersection(WorkspaceAccessLimits a, WorkspaceAccessLimits b) { CatalogMode mode = intersection(a.getMode(), b.getMode()); return new WorkspaceAccessLimits( mode, a.isReadable() && b.isReadable(), a.isWritable() && b.isWritable(), a.isAdminable() && b.isAdminable()); }
public void testSerializeWorkspaceAccessLimits() throws Exception { WorkspaceAccessLimits limits = new WorkspaceAccessLimits(CatalogMode.HIDE, true, true, true); testObjectSerialization(limits); }
@Override public WorkspaceAccessLimits getAccessLimits(Authentication user, WorkspaceInfo workspace) { LOGGER.log(Level.FINE, "Getting access limits for workspace {0}", workspace.getName()); if ((user != null) && !(user instanceof AnonymousAuthenticationToken)) { // shortcut, if the user is the admin, he can do everything if (isAdmin(user)) { LOGGER.log( Level.FINE, "Admin level access, returning " + "full rights for workspace {0}", workspace.getName()); return new WorkspaceAccessLimits(DEFAULT_CATALOG_MODE, true, true); } boolean canWrite = configurationManager .getConfiguration() .isGrantWriteToWorkspacesToAuthenticatedUsers(); boolean canAdmin = isWorkspaceAdmin(user, workspace.getName()); return new WorkspaceAccessLimits(DEFAULT_CATALOG_MODE, true, canWrite, canAdmin); } // further logic disabled because of https://github.com/geosolutions-it/geofence/issues/6 return new WorkspaceAccessLimits(DEFAULT_CATALOG_MODE, true, false); }
@Override public WorkspaceAccessLimits getAccessLimits(Authentication user, WorkspaceInfo workspace) { LOGGER.log(Level.FINE, "Getting access limits for workspace {0}", workspace.getName()); if ((user != null) && !(user instanceof AnonymousAuthenticationToken)) { // shortcut, if the user is the admin, he can do everything if (isAdmin(user)) { LOGGER.log( Level.FINE, "Admin level access, returning " + "full rights for workspace {0}", workspace.getName()); return new WorkspaceAccessLimits(DEFAULT_CATALOG_MODE, true, true); } boolean canWrite = configurationManager .getConfiguration() .isGrantWriteToWorkspacesToAuthenticatedUsers(); boolean canAdmin = isWorkspaceAdmin(user, workspace.getName()); return new WorkspaceAccessLimits(DEFAULT_CATALOG_MODE, true, canWrite, canAdmin); } // further logic disabled because of https://github.com/geosolutions-it/geofence/issues/6 return new WorkspaceAccessLimits(DEFAULT_CATALOG_MODE, true, false); }
@Test public void testReadOnlySource() throws Exception { ReadOnlyDataStore ro = new ReadOnlyDataStore( ds, WrapperPolicy.readOnlyHide( new WorkspaceAccessLimits(CatalogMode.HIDE, true, false, false))); SimpleFeatureSource fs = ro.getFeatureSource("blah"); // used to go boom here SimpleFeatureCollection fc = fs.getFeatures(Query.ALL); assertEquals(0, fc.size()); }
.andStubReturn(new WorkspaceAccessLimits(CatalogMode.HIDE, true, false, false));