congrats Icon
New! Announcing our next generation AI code completions
Read here
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

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • getApplicationContext (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Kernel (java.awt.image)
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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