congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
GeoServerRole.getUserName
Code IndexAdd Tabnine to your IDE (free)

How to use
getUserName
method
in
org.geoserver.security.impl.GeoServerRole

Best Java code snippets using org.geoserver.security.impl.GeoServerRole.getUserName (Showing top 16 results out of 315)

origin: geoserver/geoserver

public boolean isAnonymous() {
  return getUserName() == null;
}
origin: geoserver/geoserver

public String toString() {
  if (getUserName() != null) {
    StringBuffer buff = new StringBuffer(role);
    buff.append(" for user ").append(getUserName());
    return buff.toString();
  } else return role;
}
origin: geoserver/geoserver

public int hashCode() {
  int hash = getAuthority().hashCode();
  if (getUserName() != null) hash += getUserName().hashCode();
  return hash;
}
origin: geoserver/geoserver

public int compareTo(GeoServerRole o) {
  if (o == null) return 1;
  if (getAuthority().equals(o.getAuthority())) {
    if (getUserName() == null && o.getUserName() == null) return 0;
    if (getUserName() == null) return -1;
    if (o.getUserName() == null) return 1;
    return getUserName().compareTo(o.getUserName());
  }
  return getAuthority().compareTo(o.getAuthority());
}
origin: geoserver/geoserver

public boolean equals(Object obj) {
  if (obj == null) return false;
  if (obj instanceof String && getUserName() == null) {
    return equalsWithoutUserName(obj);
  }
  if (obj instanceof GrantedAuthority && getUserName() == null) {
    if (obj instanceof GeoServerRole == false) return equalsWithoutUserName(obj);
  }
  if (obj instanceof GeoServerRole) {
    return compareTo((GeoServerRole) obj) == 0;
  }
  return false;
}
origin: org.geoserver.web/gs-web-sec-core

public EditRolePage(String roleServiceName, GeoServerRole role) {
  // parent role name not known at this moment, parent
  // constructor will do the job
  super(roleServiceName, role);
  get("form:name").setEnabled(false);
  // do we have a personalized role?
  if (role.getUserName() != null) {
    get("form:properties").setEnabled(false);
    get("form:parent").setEnabled(false);
    get("form:save").setEnabled(false);
  }
}
origin: org.geoserver.web/web-security

public EditRolePage(String roleServiceName,GeoServerRole role) {
  // parent role name not known at this moment, parent
  // constructor will do the job 
  super(roleServiceName, role);
  
  get("form:name").setEnabled(false);
  // do we have a personalized role?
  if (role.getUserName()!=null ) {
    get("form:properties").setEnabled(false);
    get("form:parent").setEnabled(false);
    get("form:save").setEnabled(false);
  }
}
origin: org.geoserver.web/web-sec-core

public EditRolePage(String roleServiceName,GeoServerRole role) {
  // parent role name not known at this moment, parent
  // constructor will do the job 
  super(roleServiceName, role);
  
  get("form:name").setEnabled(false);
  // do we have a personalized role?
  if (role.getUserName()!=null ) {
    get("form:properties").setEnabled(false);
    get("form:parent").setEnabled(false);
    get("form:save").setEnabled(false);
  }
}
origin: org.geoserver.web/web-security

if (role.getUserName() == null) {
  descriptionModel = new StringResourceModel("anonymousRole", getPage(), null);
    new Object[]{role.getUserName()});
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/web-sec-core

if (role.getUserName() != null) {
  descriptionModel = new StringResourceModel("personalizedRole", getPage(), null, 
      new Object[]{role.getUserName()});            
origin: org.geoserver.web/gs-web-sec-core

newRole.setUserName(role.getUserName());
newRole.getProperties().putAll(role.getProperties());
role = newRole;
origin: org.geoserver.security/gs-security-tests

assertEquals("r1_v1", r.getProperties().get("r1_p1"));
assertEquals("r1_v2", r.getProperties().get("r1_p2"));
assertEquals("testuser", r.getUserName());
for (GrantedAuthority auth : resColl) {
  r = (GeoServerRole) auth;
  assertNull(r.getUserName());
  if ("r3".equals(r.getAuthority())) continue;
  if ("r2".equals(r.getAuthority())) {
origin: org.geoserver.web/gs-web-sec-core

if (role.getUserName() != null) {
  descriptionModel =
      new StringResourceModel("personalizedRole", getPage())
          .setParameters(role.getUserName());
} else {
  descriptionModel = new StringResourceModel("anonymousRole", getPage());
origin: org.geoserver.security/gs-security-tests

assertFalse(role == anonymousRole);
assertFalse(role.equals(anonymousRole));
assertTrue(theUser.getUsername().equals(role.getUserName()));
assertNull(anonymousRole.getUserName());
org.geoserver.security.implGeoServerRolegetUserName

Popular methods of GeoServerRole

  • getAuthority
  • <init>
  • getProperties
  • setUserName
  • equals
  • toString
  • compareTo
  • equalsWithoutUserName
  • isAnonymous

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSharedPreferences (Context)
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (Timer)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • String (java.lang)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Notification (javax.management)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now