gpt4 book ai didi

org.geoserver.security.WorkspaceAccessLimits.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 15:49:05 25 4
gpt4 key购买 nike

本文整理了Java中org.geoserver.security.WorkspaceAccessLimits.<init>()方法的一些代码示例,展示了WorkspaceAccessLimits.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkspaceAccessLimits.<init>()方法的具体详情如下:
包路径:org.geoserver.security.WorkspaceAccessLimits
类名称:WorkspaceAccessLimits
方法名:<init>

WorkspaceAccessLimits.<init>介绍

暂无

代码示例

代码示例来源:origin: geoserver/geoserver

@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);
  }
}

代码示例来源:origin: geoserver/geoserver

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);
}

代码示例来源:origin: geoserver/geoserver

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);
}

代码示例来源:origin: geoserver/geoserver

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());
}

代码示例来源:origin: org.geoserver.security/gs-security-tests

public void testSerializeWorkspaceAccessLimits() throws Exception {
  WorkspaceAccessLimits limits =
      new WorkspaceAccessLimits(CatalogMode.HIDE, true, true, true);
  testObjectSerialization(limits);
}

代码示例来源:origin: org.geoserver.community/gs-geofence

@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);
}

代码示例来源:origin: org.geoserver.extension/gs-geofence

@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);
}

代码示例来源:origin: org.geoserver.security/gs-security-tests

@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());
}

代码示例来源:origin: org.geoserver.security/gs-security-tests

.andStubReturn(new WorkspaceAccessLimits(CatalogMode.HIDE, true, false, false));

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com