Skip to content

Commit

Permalink
Rename for clarity. Add support for regex user/group #359
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Dec 20, 2013
1 parent 6c3fd65 commit dcdb780
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@
package com.dtolabs.rundeck.core.authorization.providers;

import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.*;

/**
Expand Down Expand Up @@ -100,7 +97,7 @@ public synchronized void add(final File file) throws PoliciesParseException {

private PolicyCollection createEntry(final File file) throws PoliciesParseException {
try {
return new PoliciesYaml(file);
return new YamlPolicyCollection(file);
} catch (Exception e1) {
throw new PoliciesParseException(e1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.util.Collections;
import java.util.Set;
import java.util.regex.Pattern;

/**
* Policy is contains a set of {@link AclContext} with corresponding usernames and/or groups
Expand All @@ -44,27 +45,31 @@ public interface Policy {
AclContext getContext();

/**
* Return a list of usernames as strings associated with this policy. The backing set should
* rely on the natural sorting order of HashSet<String> otherwise unexpect behavior will occur.
*
* See {@link Collections#disjoint(java.util.Collection, java.util.Collection)} if you need
* to muck with the ordering.
* Return a list of usernames as strings associated with this policy.
*
* @return usernames
*/
public Set<String> getUsernames();

/**
* Return regexes for username matching
* @return
*/
public Set<Pattern> getUsernamePatterns();

/**
*
* Return a list of group objects associated with this policy. The backing set should rely on
* the natural sorting order of HashSet<String> otherwise unexpect behavior will occur.
*
* See {@link Collections#disjoint(java.util.Collection, java.util.Collection)} if you need
* to muck with the ordering.
* Return a list of group objects associated with this policy.
*
* @return groups
*/
public Set<Object> getGroups();
public Set<String> getGroups();

/**
* Return regexes for group matching
* @return
*/
public Set<Pattern> getGroupPatterns();

/**
* Return the environmental context to test the Policy against an input environment
Expand Down
Loading

0 comments on commit dcdb780

Please sign in to comment.