ALF-1999: Refactored AuthorityService.findAuthorities to support search options required by Alfresco Explorer client in efficient manner

- optional parentAuthority argument - when set will only search for authorities under a given group
- optional immediate flag - when false means do a recursive search. When true means only return first level. When true and parentAuthority is null means root groups.
- search expression - which is tested against the short name and the display name
- reworked all existing calls for new semantics
- this method is for UI search only - not for existence checking!
  - removed some ill-informed calls


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19203 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2010-03-10 18:46:02 +00:00
parent fbe601d121
commit 36cdb669b1
8 changed files with 196 additions and 248 deletions

View File

@@ -707,10 +707,7 @@
org.alfresco.service.cmr.security.AuthorityService.getAuthorities=ACL_ALLOW
org.alfresco.service.cmr.security.AuthorityService.getAuthoritiesForUser=ACL_METHOD.ROLE_ADMINISTRATOR
org.alfresco.service.cmr.security.AuthorityService.getAllAuthorities=ACL_ALLOW
org.alfresco.service.cmr.security.AuthorityService.findAuthoritiesByShortName=ACL_ALLOW
org.alfresco.service.cmr.security.AuthorityService.findAuthoritiesByShortNameInZone=ACL_ALLOW
org.alfresco.service.cmr.security.AuthorityService.findAuthorities=ACL_ALLOW
org.alfresco.service.cmr.security.AuthorityService.findAuthoritiesInZone=ACL_ALLOW
org.alfresco.service.cmr.security.AuthorityService.getAllRootAuthorities=ACL_ALLOW
org.alfresco.service.cmr.security.AuthorityService.createAuthority=ACL_METHOD.ROLE_ADMINISTRATOR
org.alfresco.service.cmr.security.AuthorityService.addAuthority=ACL_METHOD.ROLE_ADMINISTRATOR

View File

@@ -50,14 +50,6 @@ public interface AuthorityDAO
*/
void deleteAuthority(String name);
/**
* Get all root authorities.
*
* @param type
* @return
*/
Set<String> getAllRootAuthorities(AuthorityType type);
/**
* Get contained authorities.
*
@@ -135,14 +127,35 @@ public interface AuthorityDAO
void setAuthorityDisplayName(String authorityName, String authorityDisplayName);
/**
* Find authorities by pattern.
* Find authorities by display name pattern.
*
* @param type
* @param namePattern
* @param zones - may be null to indicate all zones
* @param parentAuthority if non-null, will look only for authorities who are a child of the named parent
* @param immediate if <code>true</code> then only search root groups if parentAuthority is null, or immediate children of parentAuthority if it is non-null.
* @param displayNamePattern
* @param zoneName - may be null to indicate all zones
* @return
*/
public Set<String> findAuthorities(AuthorityType type, String namePattern, Set<String> zones);
public Set<String> findAuthorities(AuthorityType type, String parentAuthority, boolean immediate,
String displayNamePattern, String zoneName);
/**
* Extract the short name of an authority from its full identifier.
*
* @param name
* @return
*/
public String getShortName(String name);
/**
* Create the full identifier for an authority given its short name and
* type.
*
* @param type
* @param shortName
* @return
*/
public String getName(AuthorityType type, String shortName);
/**
* Gets or creates an authority zone node with the specified name
@@ -196,12 +209,4 @@ public interface AuthorityDAO
* @param zones
*/
public void removeAuthorityFromZones(String authorityName, Set<String> zones);
/**
* Get all root authorities in a zone
* @param zoneName
* @param type (optional)
* @return the set of authority names
*/
public Set<String> getAllRootAuthoritiesInZone(String zoneName, AuthorityType type);
}

View File

@@ -23,13 +23,11 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.alfresco.error.AlfrescoRuntimeException;
@@ -244,11 +242,6 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
userAuthorityCache.clear();
}
public Set<String> getAllRootAuthorities(AuthorityType type)
{
return getAllRootAuthoritiesUnderContainer(getAuthorityContainer(), type);
}
public Set<String> getAllAuthorities(AuthorityType type)
{
Set<String> authorities = new TreeSet<String>();
@@ -279,10 +272,19 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
return authorities;
}
public Set<String> findAuthorities(AuthorityType type, String namePattern, Set<String> zones)
public Set<String> findAuthorities(AuthorityType type, String parentAuthority, boolean immediate,
String displayNamePattern, String zoneName)
{
String regExpString = SearchLanguageConversion.convert(SearchLanguageConversion.DEF_LUCENE, SearchLanguageConversion.DEF_REGEX, namePattern);
Pattern pattern = Pattern.compile(regExpString, Pattern.CASE_INSENSITIVE);
Pattern pattern = displayNamePattern == null ? null : Pattern.compile(SearchLanguageConversion.convert(
SearchLanguageConversion.DEF_LUCENE, SearchLanguageConversion.DEF_REGEX, displayNamePattern),
Pattern.CASE_INSENSITIVE);
// Use SQL to determine root authorities
if (parentAuthority == null && immediate)
{
return getRootAuthoritiesUnderContainer(zoneName == null ? getAuthorityContainer() : getZone(zoneName),
type, pattern);
}
Set<String> authorities = new TreeSet<String>();
SearchParameters sp = new SearchParameters();
sp.addStore(this.storeRef);
@@ -297,7 +299,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
query.append("TYPE:\"").append(ContentModel.TYPE_PERSON).append("\" AND @").append(
LuceneQueryParser.escape("{" + ContentModel.PROP_USERNAME.getNamespaceURI() + "}"
+ ISO9075.encode(ContentModel.PROP_USERNAME.getLocalName()))).append(":\"").append(
namePattern).append("\"");
displayNamePattern).append("\"");
if (type == null)
{
query.append(") OR (");
@@ -305,28 +307,39 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
}
if (type != AuthorityType.USER)
{
query.append("TYPE:\"").append(ContentModel.TYPE_AUTHORITY_CONTAINER).append("\" AND @").append(
query.append("TYPE:\"").append(ContentModel.TYPE_AUTHORITY_CONTAINER).append("\" AND (@").append(
LuceneQueryParser.escape("{" + ContentModel.PROP_AUTHORITY_NAME.getNamespaceURI() + "}"
+ ISO9075.encode(ContentModel.PROP_AUTHORITY_NAME.getLocalName()))).append(":\"").append(
namePattern).append("\"");
+ ISO9075.encode(ContentModel.PROP_AUTHORITY_NAME.getLocalName()))).append(":\"");
// Allow for the appropriate type prefix in the authority name
if (type == null && !displayNamePattern.startsWith("*"))
{
query.append("*").append(displayNamePattern);
}
else
{
query.append(getName(type, displayNamePattern));
}
query.append("\" OR @").append(
LuceneQueryParser.escape("{" + ContentModel.PROP_AUTHORITY_DISPLAY_NAME.getNamespaceURI() + "}"
+ ISO9075.encode(ContentModel.PROP_AUTHORITY_DISPLAY_NAME.getLocalName()))).append(":\"").append(
displayNamePattern).append("\")");
if (type == null)
{
query.append("))");
}
}
if (zones != null)
if (parentAuthority != null)
{
query.append(" AND PATH:(");
Iterator<String> i = zones.iterator();
while (i.hasNext())
query.append(" AND PATH:\"/sys:system/sys:authorities/cm:").append(ISO9075.encode(parentAuthority));
if (!immediate)
{
query.append("\"/sys:system/sys:zones/cm:").append(ISO9075.encode(i.next())).append("/*\"");
if (i.hasNext())
{
query.append(" ");
query.append('/');
}
query.append("/*\"");
}
query.append(")");
if (zoneName != null)
{
query.append(" AND PATH:\"/sys:system/sys:zones/cm:").append(ISO9075.encode(zoneName)).append("/*\"");
}
sp.setQuery(query.toString());
sp.setMaxItems(100);
@@ -372,7 +385,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
}
Set<String> authorities = new TreeSet<String>();
findAuthorities(type, null, nodeRef, authorities, false, !immediate, false);
findAuthorities(type, nodeRef, authorities, false, !immediate, false);
return authorities;
}
}
@@ -435,7 +448,41 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
}
}
private void addAuthorityNameIfMatches(Set<String> authorities, String authorityName, AuthorityType type, Pattern pattern)
public String getShortName(String name)
{
AuthorityType type = AuthorityType.getAuthorityType(name);
if (type.isFixedString())
{
return "";
}
else if (type.isPrefixed())
{
return name.substring(type.getPrefixString().length());
}
else
{
return name;
}
}
public String getName(AuthorityType type, String shortName)
{
if (type.isFixedString())
{
return type.getFixedString();
}
else if (type.isPrefixed())
{
return type.getPrefixString() + shortName;
}
else
{
return shortName;
}
}
private void addAuthorityNameIfMatches(Set<String> authorities, String authorityName, AuthorityType type,
Pattern pattern)
{
if (type == null || AuthorityType.getAuthorityType(authorityName).equals(type))
{
@@ -445,11 +492,18 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
}
else
{
Matcher m = pattern.matcher(authorityName);
if (m.matches())
if (pattern.matcher(getShortName(authorityName)).matches())
{
authorities.add(authorityName);
}
else
{
String displayName = getAuthorityDisplayName(authorityName);
if (displayName != null && pattern.matcher(displayName).matches())
{
authorities.add(authorityName);
}
}
}
}
}
@@ -467,7 +521,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
if (ref != null)
{
findAuthorities(type, null, ref, authorities, parents, recursive, false);
findAuthorities(type, ref, authorities, parents, recursive, false);
}
else if (!localType.equals(AuthorityType.USER))
{
@@ -478,7 +532,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
}
}
private void findAuthorities(AuthorityType type, Pattern pattern, NodeRef nodeRef, Set<String> authorities, boolean parents, boolean recursive, boolean includeNode)
private void findAuthorities(AuthorityType type, NodeRef nodeRef, Set<String> authorities, boolean parents, boolean recursive, boolean includeNode)
{
if (includeNode)
{
@@ -486,7 +540,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
.getProperty(nodeRef, dictionaryService.isSubClass(nodeService.getType(nodeRef),
ContentModel.TYPE_AUTHORITY_CONTAINER) ? ContentModel.PROP_AUTHORITY_NAME
: ContentModel.PROP_USERNAME));
addAuthorityNameIfMatches(authorities, authorityName, type, pattern);
addAuthorityNameIfMatches(authorities, authorityName, type, null);
}
// Loop over children if we want immediate children or are in recursive mode
@@ -498,7 +552,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
for (ChildAssociationRef car : cars)
{
findAuthorities(type, pattern, car.getParentRef(), authorities, true, recursive, true);
findAuthorities(type, car.getParentRef(), authorities, true, recursive, true);
}
}
else
@@ -511,10 +565,10 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
{
String childName = car.getQName().getLocalName();
AuthorityType childType = AuthorityType.getAuthorityType(childName);
addAuthorityNameIfMatches(authorities, childName, type, pattern);
addAuthorityNameIfMatches(authorities, childName, type, null);
if (recursive && childType != AuthorityType.USER)
{
findAuthorities(type, pattern, car.getChildRef(), authorities, false, true, false);
findAuthorities(type, car.getChildRef(), authorities, false, true, false);
}
}
}
@@ -779,13 +833,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
}
}
public Set<String> getAllRootAuthoritiesInZone(String zoneName, AuthorityType type)
{
NodeRef zone = getZone(zoneName);
return zone == null ? Collections.<String> emptySet() : getAllRootAuthoritiesUnderContainer(zone, type);
}
private Set<String> getAllRootAuthoritiesUnderContainer(NodeRef container, AuthorityType type)
private Set<String> getRootAuthoritiesUnderContainer(NodeRef container, AuthorityType type, Pattern pattern)
{
if (type != null && type.equals(AuthorityType.USER))
{
@@ -795,7 +843,7 @@ public class AuthorityDAOImpl implements AuthorityDAO, NodeServicePolicies.Befor
Set<String> authorities = new TreeSet<String>();
for (ChildAssociationRef childRef : childRefs)
{
addAuthorityNameIfMatches(authorities, childRef.getQName().getLocalName(), type, null);
addAuthorityNameIfMatches(authorities, childRef.getQName().getLocalName(), type, pattern);
}
return authorities;
}

View File

@@ -297,20 +297,6 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
return authorities;
}
public Set<String> findAuthorities(AuthorityType type, String namePattern)
{
return findAuthoritiesInZone(type, namePattern, null);
}
public Set<String> findAuthoritiesByShortName(AuthorityType type, String shortNamePattern)
{
String fullNamePattern = getName(type, shortNamePattern);
return findAuthorities(type, fullNamePattern);
}
public void addAuthority(String parentName, String childName)
{
addAuthority(Collections.singleton(parentName), childName);
@@ -391,7 +377,7 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
public Set<String> getAllRootAuthorities(AuthorityType type)
{
return authorityDAO.getAllRootAuthorities(type);
return authorityDAO.findAuthorities(type, null, true, null, null);
}
public Set<String> getContainedAuthorities(AuthorityType type, String name, boolean immediate)
@@ -404,40 +390,6 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
return authorityDAO.getContainingAuthorities(type, name, immediate);
}
public String getName(AuthorityType type, String shortName)
{
if (type.isFixedString())
{
return type.getFixedString();
}
else if (type.isPrefixed())
{
return type.getPrefixString() + shortName;
}
else
{
return shortName;
}
}
public String getShortName(String name)
{
AuthorityType type = AuthorityType.getAuthorityType(name);
if (type.isFixedString())
{
return "";
}
else if (type.isPrefixed())
{
return name.substring(type.getPrefixString().length());
}
else
{
return name;
}
}
public void removeAuthority(String parentName, String childName)
{
authorityDAO.removeAuthority(parentName, childName);
@@ -512,40 +464,35 @@ public class AuthorityServiceImpl implements AuthorityService, InitializingBean
public Set<String> getAllRootAuthoritiesInZone(String zoneName, AuthorityType type)
{
return authorityDAO.getAllRootAuthoritiesInZone(zoneName, type);
return authorityDAO.findAuthorities(type, null, true, null, zoneName);
}
public Set<String> findAuthoritiesByShortNameInZone(AuthorityType type, String shortNamePattern, String zone)
public Set<String> findAuthorities(AuthorityType type, String parentAuthority, boolean immediate,
String displayNamePattern, String zoneName)
{
String fullNamePattern = getName(type, shortNamePattern);
return findAuthoritiesInZone(type, fullNamePattern, zone);
if (type == null || type == AuthorityType.GROUP || type == AuthorityType.USER)
{
return authorityDAO.findAuthorities(type, parentAuthority, immediate, displayNamePattern, zoneName);
}
else
{
throw new UnsupportedOperationException();
}
}
public Set<String> findAuthoritiesInZone(AuthorityType type, String namePattern, String zone)
/* (non-Javadoc)
* @see org.alfresco.service.cmr.security.AuthorityService#getName(org.alfresco.service.cmr.security.AuthorityType, java.lang.String)
*/
public String getName(AuthorityType type, String shortName)
{
Set<String> authorities = new HashSet<String>();
switch (type)
{
case ADMIN:
case EVERYONE:
case GUEST:
throw new UnsupportedOperationException();
case GROUP:
Set<String> zones = null;
if(zone != null)
{
zones = Collections.singleton(zone);
return authorityDAO.getName(type, shortName);
}
authorities.addAll(authorityDAO.findAuthorities(type, namePattern, zones));
break;
case OWNER:
case ROLE:
throw new UnsupportedOperationException();
case USER:
throw new UnsupportedOperationException();
default:
break;
}
return authorities;
/* (non-Javadoc)
* @see org.alfresco.service.cmr.security.AuthorityService#getShortName(java.lang.String)
*/
public String getShortName(String name)
{
return authorityDAO.getShortName(name);
}
}

View File

@@ -268,25 +268,25 @@ public class AuthorityServiceTest extends TestCase
}
int size = end - 'a' + 1;
before = System.nanoTime();
Set<String> matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, "GROUP___*__a*");
Set<String> matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, null, false, "__*__a*", null);
after = System.nanoTime();
System.out.println("GROUP___a* in " + ((after - before) / 1000000000.0f));
assertEquals(size * size * zones.length, matches.size());
before = System.nanoTime();
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, "GROUP___*__aa*");
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, null, false, "__*__aa*", null);
after = System.nanoTime();
System.out.println("GROUP___aa* in " + ((after - before) / 1000000000.0f));
assertEquals(size * zones.length, matches.size());
before = System.nanoTime();
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, "GROUP___*__*aa");
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, null, false, "__*__*aa", null);
after = System.nanoTime();
System.out.println("GROUP___*aa in " + ((after - before) / 1000000000.0f));
assertEquals(size * zones.length, matches.size());
before = System.nanoTime();
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, "GROUP___*__*a");
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, null, false, "__*__*a", null);
after = System.nanoTime();
System.out.println("GROUP___*a in " + ((after - before) / 1000000000.0f));
assertEquals(size * size * zones.length, matches.size());
@@ -298,25 +298,25 @@ public class AuthorityServiceTest extends TestCase
if (zone != null)
{
before = System.nanoTime();
matches = pubAuthorityService.findAuthoritiesInZone(AuthorityType.GROUP, "GROUP___*__a*", zone);
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, null, false, "__*__a*", zone);
after = System.nanoTime();
System.out.println("GROUP___a* in " + ((after - before) / 1000000000.0f));
assertEquals(size * size, matches.size());
before = System.nanoTime();
matches = pubAuthorityService.findAuthoritiesInZone(AuthorityType.GROUP, "GROUP___*__aa*", zone);
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, null, false, "__*__aa*", zone);
after = System.nanoTime();
System.out.println("GROUP___aa* in " + ((after - before) / 1000000000.0f));
assertEquals(size, matches.size());
before = System.nanoTime();
matches = pubAuthorityService.findAuthoritiesInZone(AuthorityType.GROUP, "GROUP___*__*aa", zone);
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, null, false, "__*__*aa", zone);
after = System.nanoTime();
System.out.println("GROUP___*aa in " + ((after - before) / 1000000000.0f));
assertEquals(size, matches.size());
before = System.nanoTime();
matches = pubAuthorityService.findAuthoritiesInZone(AuthorityType.GROUP, "GROUP___*__*a", zone);
matches = pubAuthorityService.findAuthorities(AuthorityType.GROUP, null, false, "__*__*a", zone);
after = System.nanoTime();
System.out.println("GROUP___*a in " + ((after - before) / 1000000000.0f));
assertEquals(size * size, matches.size());

View File

@@ -188,13 +188,6 @@ public class SimpleAuthorityServiceImpl implements AuthorityService
return authorities;
}
public Set<String> findAuthorities(AuthorityType type, String namePattern)
{
return Collections.<String>emptySet();
}
public void addAuthority(String parentName, String childName)
{
@@ -304,13 +297,6 @@ public class SimpleAuthorityServiceImpl implements AuthorityService
}
public Set<String> findAuthoritiesByShortName(AuthorityType type,
String shortNamePattern)
{
String fullNamePattern = getName(type, shortNamePattern);
return findAuthorities(type, fullNamePattern);
}
public Set<String> getAllAuthoritiesInZone(String zoneName, AuthorityType type)
{
return Collections.<String>emptySet();
@@ -351,18 +337,14 @@ public class SimpleAuthorityServiceImpl implements AuthorityService
}
public Set<String> findAuthoritiesByShortNameInZone(AuthorityType type, String shortNamePattern, String zone)
{
return Collections.<String>emptySet();
}
public Set<String> findAuthoritiesInZone(AuthorityType type, String namePattern, String zone)
{
return Collections.<String>emptySet();
}
public NodeRef getZone(String zoneName)
{
return null;
}
public Set<String> findAuthorities(AuthorityType type, String parentAuthority, boolean immediate,
String displayNamePattern, String zoneName)
{
return Collections.emptySet();
}
}

View File

@@ -51,18 +51,16 @@ public class ScriptAuthorityService extends BaseScopableProcessorExtension
* Search the root groups, those without a parent group.
* @return The root groups (empty if there are no root groups)
*/
public ScriptGroup[] searchRootGroupsInZone(String shortNamePattern, String zone)
public ScriptGroup[] searchRootGroupsInZone(String displayNamePattern, String zone)
{
Set<ScriptGroup> groups = new LinkedHashSet<ScriptGroup>(0);
Set<String> authorities = authorityService.findAuthoritiesByShortNameInZone(AuthorityType.GROUP, shortNamePattern, zone);
Set<String> authorities = authorityService.findAuthorities(AuthorityType.GROUP, null, true, displayNamePattern,
zone);
for (String authority : authorities)
{
ScriptGroup group = new ScriptGroup(authority, authorityService);
if (group.isRootGroup())
{
groups.add(group);
}
}
return groups.toArray(new ScriptGroup[groups.size()]);
}
@@ -70,18 +68,16 @@ public class ScriptAuthorityService extends BaseScopableProcessorExtension
* Search the root groups, those without a parent group.
* @return The root groups (empty if there are no root groups)
*/
public ScriptGroup[] searchRootGroups(String shortNamePattern)
public ScriptGroup[] searchRootGroups(String displayNamePattern)
{
Set<ScriptGroup> groups = new LinkedHashSet<ScriptGroup>();
Set<String> authorities = authorityService.findAuthoritiesByShortName(AuthorityType.GROUP, shortNamePattern);
Set<String> authorities = authorityService.findAuthorities(AuthorityType.GROUP, null, true, displayNamePattern,
null);
for (String authority : authorities)
{
ScriptGroup group = new ScriptGroup(authority, authorityService);
if (group.isRootGroup())
{
groups.add(group);
}
}
return groups.toArray(new ScriptGroup[groups.size()]);
}
@@ -182,7 +178,7 @@ public class ScriptAuthorityService extends BaseScopableProcessorExtension
}
Set<ScriptGroup> groups = new LinkedHashSet<ScriptGroup>();
Set<String> authorities = authorityService.findAuthoritiesByShortName(AuthorityType.GROUP, filter);
Set<String> authorities = authorityService.findAuthorities(AuthorityType.GROUP, null, false, filter, null);
for(String authority : authorities)
{
ScriptGroup group = new ScriptGroup(authority, authorityService);
@@ -211,7 +207,7 @@ public class ScriptAuthorityService extends BaseScopableProcessorExtension
}
Set<ScriptGroup> groups = new LinkedHashSet<ScriptGroup>();
Set<String> authorities = authorityService.findAuthoritiesByShortNameInZone(AuthorityType.GROUP, filter, zone);
Set<String> authorities = authorityService.findAuthorities(AuthorityType.GROUP, null, false, filter, zone);
for(String authority : authorities)
{
ScriptGroup group = new ScriptGroup(authority, authorityService);

View File

@@ -135,26 +135,6 @@ public interface AuthorityService
@Auditable(parameters = {"type"})
public Set<String> getAllAuthorities(AuthorityType type);
/**
* Find authorities by pattern matching (* and ?) against the authority name.
* @param type - the authority type
* @param namePattern - the pattern which will be matched against the shortName.
* @return the names of the authorities matching the pattern and type.
*/
@Auditable(parameters = {"type"})
public Set<String> findAuthoritiesByShortName(AuthorityType type, String shortNamePattern);
/**
* Find authorities by pattern matching (* and ?) against the full authority name.
* @param type - the authority type
* @param namePattern - the pattern which will be matched against the full authority name.
* @return the names of the authorities matching the pattern and type.
*/
@Auditable(parameters = {"type"})
public Set<String> findAuthorities(AuthorityType type, String namePattern);
/**
* Get all root authorities by type. Root authorities are ones that were
* created without an authority as the parent authority;
@@ -419,23 +399,16 @@ public interface AuthorityService
public Set<String> getDefaultZones();
/**
* Find authorities by pattern matching (* and ?) against the full authority name in a particular zone
* @param type - the authority type
* @param namePattern - the pattern which will be matched against the full authority name.
* @param zone - the zone
* @return the names of the authorities matching the pattern and type.
*/
@Auditable(parameters = {"type"})
public Set<String> findAuthoritiesInZone(AuthorityType type, String namePattern, String zone);
/**
* Find authorities by pattern matching (* and ?) against the authority name.
* @param type - the authority type
* @param shortNamePattern - the pattern which will be matched against the shortName.
* @param zone
* @return the names of the authorities matching the pattern and type.
* @param type
* @param parentAuthority if non-null, will look only for authorities who are a child of the named parent
* @param immediate if <code>true</code> then only search root groups if parentAuthority is null, or immediate children of parentAuthority if it is non-null.
* @param displayNamePattern
* @param zoneName - may be null to indicate all zones
* @return
*/
@Auditable(parameters = {"type"})
public Set<String> findAuthoritiesByShortNameInZone(AuthorityType type, String shortNamePattern, String zone);
public Set<String> findAuthorities(AuthorityType type, String parentAuthority, boolean immediate,
String displayNamePattern, String zoneName);
}