Codota Logo
GeoServerRoleStore.setParentRole
Code IndexAdd Codota to your IDE (free)

How to use
setParentRole
method
in
org.geoserver.security.GeoServerRoleStore

Best Java code snippets using org.geoserver.security.GeoServerRoleStore.setParentRole (Showing top 16 results out of 315)

  • Common ways to obtain GeoServerRoleStore
private void myMethod () {
GeoServerRoleStore g =
  • Codota IconGeoServerRoleService geoServerRoleService;geoServerRoleService.createStore()
  • Smart code suggestions by Codota
}
origin: geoserver/geoserver

@Override
public void setParentRole(GeoServerRole role, GeoServerRole parentRole) throws IOException {
  if (filterRole(role) != null && filterRole(parentRole) != null) {
    delegateAsStore().setParentRole(role, parentRole);
  }
}
origin: geoserver/geoserver

/**
 * WRITE_LOCK
 *
 * @see
 *     org.geoserver.security.GeoServerRoleStore#setParentRole(org.geoserver.security.impl.GeoServerRole,
 *     org.geoserver.security.impl.GeoServerRole)
 */
public void setParentRole(GeoServerRole role, GeoServerRole parentRole) throws IOException {
  writeLock();
  try {
    getStore().setParentRole(role, parentRole);
  } finally {
    writeUnLock();
  }
}
origin: geoserver/geoserver

  public void setParentRole(GeoServerRole role, GeoServerRole parentRole) throws IOException {
    checkExistingRoleName(role.getAuthority());
    if (parentRole != null) checkExistingRoleName(parentRole.getAuthority());
    getStore().setParentRole(role, parentRole);
  }
}
origin: geoserver/geoserver

GeoServerRole newParentRole =
    parentRole == null ? null : newRoleDict.get(parentRole.getAuthority());
store.setParentRole(newRole, newParentRole);
origin: geoserver/geoserver

public void modifyValues(GeoServerRoleStore roleStore) throws IOException {
  GeoServerRole role_auth = roleStore.getRoleByName("ROLE_AUTHENTICATED");
  GeoServerRole role_wfs = roleStore.getRoleByName("ROLE_WFS");
  GeoServerRole role_wms = roleStore.getRoleByName("ROLE_WMS");
  role_auth.getProperties().remove("bbox");
  role_auth.getProperties().setProperty("employee", "4711");
  roleStore.updateRole(role_auth);
  role_wms.getProperties().setProperty("envelope", "10 10 20 20");
  roleStore.updateRole(role_wms);
  roleStore.disAssociateRoleFromGroup(role_wfs, "g_all");
  roleStore.disAssociateRoleFromUser(role_wfs, "user1");
  roleStore.setParentRole(role_wms, null);
  roleStore.setParentRole(role_wfs, role_wms);
}
origin: geoserver/geoserver

public void insertValues(GeoServerRoleStore roleStore) throws IOException {
  GeoServerRole role_admin =
      roleStore.createRoleObject(GeoServerRole.ADMIN_ROLE.getAuthority());
  GeoServerRole role_auth = roleStore.createRoleObject("ROLE_AUTHENTICATED");
  GeoServerRole role_wfs = roleStore.createRoleObject("ROLE_WFS");
  GeoServerRole role_wms = roleStore.createRoleObject("ROLE_WMS");
  role_auth.getProperties().put("employee", "");
  role_auth.getProperties().put("bbox", "lookupAtRuntime");
  roleStore.addRole(role_admin);
  roleStore.addRole(role_auth);
  roleStore.addRole(role_wfs);
  roleStore.addRole(role_wms);
  roleStore.setParentRole(role_wms, role_auth);
  roleStore.setParentRole(role_wfs, role_auth);
  roleStore.associateRoleToUser(role_admin, "admin");
  roleStore.associateRoleToUser(role_wms, "user1");
  roleStore.associateRoleToUser(role_wfs, "user1");
  roleStore.associateRoleToGroup(role_wms, "g_wms");
  roleStore.associateRoleToGroup(role_wfs, "g_wfs");
  roleStore.associateRoleToGroup(role_wms, "g_all");
  roleStore.associateRoleToGroup(role_wfs, "g_all");
}
origin: geoserver/geoserver

protected void createServices() throws Exception {
  GeoServerRoleService rservice = createRoleService("rs1");
  GeoServerRoleStore rstore = rservice.createStore();
  GeoServerRole root, derived;
  rstore.addRole(root = rstore.createRoleObject(rootRole));
  rstore.addRole(derived = rstore.createRoleObject(derivedRole));
  rstore.setParentRole(derived, root);
  rstore.associateRoleToUser(derived, testUserName);
  rstore.associateRoleToUser(derived, "castest");
  rstore.store();
  SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig();
  mconfig.setRoleServiceName("rs1");
  getSecurityManager().saveSecurityConfig(mconfig);
  GeoServerUserGroupService ugservice = createUserGroupService("ug1");
  GeoServerUserGroupStore ugstore = ugservice.createStore();
  GeoServerUser u1 = ugstore.createUserObject(testUserName, testPassword, true);
  ugstore.addUser(u1);
  GeoServerUser u2 = ugstore.createUserObject("abc@xyz.com", "abc", true);
  ugstore.addUser(u2);
  GeoServerUser u3 = ugstore.createUserObject("castest", "castest", true);
  ugstore.addUser(u3);
  ugstore.store();
  GeoServerAuthenticationProvider prov =
      createAuthProvider(testProviderName, ugservice.getName());
  prepareAuthProviders(prov.getName());
}
origin: geoserver/geoserver

store.setParentRole(role, role_parent);
assertTrue(store.isModified());
store.store();
store.setParentRole(role, null);
assertTrue(store.isModified());
store.store();
origin: org.geoserver.web/web-sec-core

@Override
protected void onFormSubmit(GeoServerRole updated) throws IOException{
  
  if (hasRoleStore(roleServiceName)==false) {
    throw new RuntimeException("Invalid workflow, cannot store in a read only role service");
  }
  GeoServerRoleStore store=null;
  try {
    store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName));
    GeoServerRole role = store.getRoleByName(updated.getAuthority());
    role.getProperties().clear();
    role.getProperties().putAll(updated.getProperties());
    store.updateRole(role);
    String parentRoleName = get("form:parent").getDefaultModelObjectAsString();
    if (parentRoleName != null) {
      GeoServerRole parentRole = store.getRoleByName(parentRoleName);
      store.setParentRole(role, parentRole);
    }
    store.store();
  } catch (IOException ex) {
    try {store.load(); } catch (IOException ex2) {};
    throw ex;
  }
}
origin: org.geoserver.web/web-security

@Override
protected void onFormSubmit(GeoServerRole updated) throws IOException{
  
  if (hasRoleStore(roleServiceName)==false) {
    throw new RuntimeException("Invalid workflow, cannot store in a read only role service");
  }
  GeoServerRoleStore store=null;
  try {
    store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName));
    GeoServerRole role = store.getRoleByName(updated.getAuthority());
    role.getProperties().clear();
    role.getProperties().putAll(updated.getProperties());
    store.updateRole(role);
    String parentRoleName = get("form:parent").getDefaultModelObjectAsString();
    if (parentRoleName != null) {
      GeoServerRole parentRole = store.getRoleByName(parentRoleName);
      store.setParentRole(role, parentRole);
    }
    store.store();
  } catch (IOException ex) {
    try {store.load(); } catch (IOException ex2) {};
    throw ex;
  }
}
origin: org.geoserver.web/gs-web-sec-core

if (parentRoleName != null) {
  GeoServerRole parentRole = store.getRoleByName(parentRoleName);
  store.setParentRole(role, parentRole);
origin: org.geoserver.web/web-sec-core

@Override
protected void onFormSubmit(GeoServerRole role) throws IOException {
  
  GeoServerRoleStore store = null;
  try {
    store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName));
    //copy into a new one so we can set the name properly
    GeoServerRole newRole= store.createRoleObject(get("form:name").getDefaultModelObjectAsString());
    newRole.setUserName(role.getUserName());
    newRole.getProperties().putAll(role.getProperties());
    role = newRole;                        
    store.addRole(role);
    String parentRoleName = get("form:parent").getDefaultModelObjectAsString();
    if (parentRoleName != null) {
      GeoServerRole parentRole = store.getRoleByName(parentRoleName);
      store.setParentRole(role, parentRole);
    }
    store.store();
  } catch (IOException ex) {
    try {store.load(); } catch (IOException ex2) {};
    throw ex;
  }
}
origin: org.geoserver.web/web-security

@Override
protected void onFormSubmit(GeoServerRole role) throws IOException {
  
  GeoServerRoleStore store = null;
  try {
    //copy into a new one so we can set the name properly
    GeoServerRole newRole = 
      new GeoServerRole(get("form:name").getDefaultModelObjectAsString());
    newRole.setUserName(role.getUserName());
    newRole.getProperties().putAll(role.getProperties());
    role = newRole;
    store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName));
    store.addRole(role);
    String parentRoleName = get("form:parent").getDefaultModelObjectAsString();
    if (parentRoleName != null) {
      GeoServerRole parentRole = store.getRoleByName(parentRoleName);
      store.setParentRole(role, parentRole);
    }
    store.store();
  } catch (IOException ex) {
    try {store.load(); } catch (IOException ex2) {};
    throw ex;
  }
}
origin: org.geoserver.web/gs-web-sec-core

if (parentRoleName != null) {
  GeoServerRole parentRole = store.getRoleByName(parentRoleName);
  store.setParentRole(role, parentRole);
origin: org.geoserver.security/gs-security-tests

role = roleStore.createRoleObject("grouprole2aa");
roleStore.addRole(role);
roleStore.setParentRole(tmp, role);
roles.add(role);
checkRoles(username, roles);
role = roleStore.createRoleObject("grouprole2aaa");
roleStore.addRole(role);
roleStore.setParentRole(tmp, role);
roles.add(role);
checkRoles(username, roles);
roleStore.setParentRole(tmp, null);
roles.remove(role);
checkRoles(username, roles);
origin: org.geoserver.security/gs-security-tests

  store2.setParentRole(role_test1, null);
} catch (IOException ex) {
  fail = false;
org.geoserver.securityGeoServerRoleStoresetParentRole

Javadoc

Sets the parent role, the method must check if parentRole is not equal to role and if parentRole is not contained in the descendants of role

This code sequence will do the job RoleHierarchyHelper helper = new RoleHierarchyHelper(getParentMappings()); if (helper.isValidParent(role.getAuthority(), parentRole==null ? null : parentRole.getAuthority())==false) throw new IOException(parentRole.getAuthority() + " is not a valid parent for " + role.getAuthority());

Popular methods of GeoServerRoleStore

  • addRole
  • associateRoleToUser
  • store
  • createRoleObject
  • associateRoleToGroup
  • disAssociateRoleFromUser
  • getRoleByName
  • load
  • removeRole
  • disAssociateRoleFromGroup
  • updateRole
  • clear
  • updateRole,
  • clear,
  • getRolesForGroup,
  • getRolesForUser,
  • isModified,
  • getAdminRole,
  • getGroupAdminRole,
  • getGroupNamesForRole,
  • getName

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSystemService (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • String (java.lang)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now