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

How to use
RolesACL
in
jrds.webapp

Best Java code snippets using jrds.webapp.RolesACL (Showing top 5 results out of 315)

origin: fbacchella/jrds

@Override
public ACL join(ACL acl) {
  if(acl instanceof RolesACL) {
    Set<String> newRoles = new HashSet<String>(roles);
    newRoles.addAll(((RolesACL) acl).getRoles());
    return new RolesACL(newRoles);
  } else if(acl instanceof AdminACL) {
    Set<String> newRoles = new HashSet<String>(roles);
    newRoles.add(((AdminACL) acl).getAdminRole());
    return new RolesACL(newRoles);
  } else {
    return this;
  }
}
origin: fbacchella/jrds

private void addFilter(Filter newFilter) {
  filters.put(newFilter.getName(), newFilter);
  ACL acl = newFilter.getACL();
  if(acl instanceof RolesACL) {
    roles.addAll(((RolesACL) acl).getRoles());
  }
  log(Level.DEBUG, "Filter %s added with ACL %s", newFilter.getName(), newFilter.getACL());
}
origin: fbacchella/jrds

/**
 * Add a roles ACL to the object being build, but only if security was set
 * in the properties. If the xpath match no roles, the object will have no
 * ACL set, so it will use it's own default ACL.
 * 
 * @param object The object to add a role to
 * @param n The DOM tree where the xpath will look into
 * @param roleElements the role element
 */
protected void doACL(WithACL object, JrdsDocument n, JrdsElement roleElements) {
  if(pm.security) {
    List<String> roles = new ArrayList<String>();
    for(JrdsElement e: roleElements.getChildElementsByName("role")) {
      roles.add(e.getTextContent());
    }
    if(roles.size() > 0) {
      object.addACL(new RolesACL(new HashSet<String>(roles)));
      object.addACL(pm.adminACL);
    } else {
      object.addACL(pm.defaultACL);
    }
  }
}
origin: fbacchella/jrds

@Test
public void testSecurity() throws IOException {
  PropertiesManager pm = new PropertiesManager();
  pm.setProperty("configdir", testFolder.getRoot().getCanonicalPath());
  pm.setProperty("rrddir", testFolder.getRoot().getCanonicalPath());
  pm.setProperty("tmpdir", testFolder.getRoot().getCanonicalPath());
  pm.setProperty("security", "true");
  pm.setProperty("adminrole", "role1");
  pm.setProperty("defaultroles", " role2 ,role3");
  pm.update();
  Assert.assertEquals("Bad default ACL class", RolesACL.class, pm.defaultACL.getClass());
  RolesACL rolesacl = (RolesACL) pm.defaultACL;
  Assert.assertTrue("Admin role1 not found", rolesacl.getRoles().contains("role1"));
  Assert.assertTrue("default role role2 not found", rolesacl.getRoles().contains("role2"));
  Assert.assertTrue("default role role3 not found", rolesacl.getRoles().contains("role3"));
  Assert.assertEquals("Bad adminACL", AdminACL.class, pm.adminACL.getClass());
  AdminACL adminacl = (AdminACL) pm.adminACL;
  Assert.assertEquals("Bad admin role", "role1", adminacl.getAdminRole());
}
origin: fbacchella/jrds

  defaultRoles.add(aRole.trim());
defaultACL = new RolesACL(defaultRoles);
defaultACL = defaultACL.join(adminACL);
jrds.webappRolesACL

Most used methods

  • getRoles
  • <init>

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • setRequestProperty (URLConnection)
  • addToBackStack (FragmentTransaction)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Permission (java.security)
    Legacy security code; do not use.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • IsNull (org.hamcrest.core)
    Is the value null?
  • 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