Class ScriptAuthorityService
- java.lang.Object
-
- org.alfresco.repo.processor.BaseProcessorExtension
-
- org.alfresco.repo.jscript.BaseScopableProcessorExtension
-
- org.alfresco.repo.security.authority.script.ScriptAuthorityService
-
- All Implemented Interfaces:
org.alfresco.processor.ProcessorExtension,Scopeable
public class ScriptAuthorityService extends BaseScopableProcessorExtension
Script object representing the authority service. Provides Script access to groups and may in future be extended for roles and people.- Author:
- Mark Rogers
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringON_FIRST_SPACERegEx to split a String on the first space.
-
Constructor Summary
Constructors Constructor Description ScriptAuthorityService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ScriptGroupcreateRootGroup(java.lang.String shortName, java.lang.String displayName)Create a new root group in the default application zonesScriptGroup[]getAllRootGroups()Search the root groups, those without a parent group.ScriptGroup[]getAllRootGroups(int maxItems, int skipCount)Search the root groups, those without a parent group.ScriptGroup[]getAllRootGroups(ScriptPagingDetails paging)Search the root groups, those without a parent group.ScriptGroup[]getAllRootGroupsInZone(java.lang.String zone)Get the root groups, those without a parent group.ScriptGroup[]getAllRootGroupsInZone(java.lang.String zone, int maxItems, int skipCount)Get the root groups, those without a parent group.ScriptGroup[]getAllRootGroupsInZone(java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy)Get the root groups, those without a parent group.AuthorityServicegetAuthorityService()ScriptGroupgetGroup(java.lang.String shortName)Get a group given its short nameScriptGroupgetGroupForFullAuthorityName(java.lang.String fullAuthorityName)Get a group given it full authority name (Which must begin with 'GROUP_'ScriptGroup[]getGroups(java.lang.String filter, ScriptPagingDetails paging)Retreives groups matching the given filter from all zones.ScriptGroup[]getGroups(java.lang.String filter, ScriptPagingDetails paging, java.lang.String sortBy)Retreives groups matching the given filter from all zones.ScriptGroup[]getGroupsInZone(java.lang.String filter, java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy)Deprecated.ScriptGroup[]getGroupsInZone(java.lang.String filter, java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy, boolean sortAsc)Retrieves groups matching the given filter from the given zone.ScriptUsergetUser(java.lang.String username)Get a user given their usernameScriptGroup[]searchGroups(java.lang.String shortNameFilter)Search for groups in all zones.ScriptGroup[]searchGroups(java.lang.String shortNameFilter, ScriptPagingDetails paging, java.lang.String sortBy)Search for groups in all zones.ScriptGroup[]searchGroupsInZone(java.lang.String shortNameFilter, java.lang.String zone)Search for groups in a specific zoneScriptGroup[]searchGroupsInZone(java.lang.String shortNameFilter, java.lang.String zone, int maxItems, int skipCount)Search for groups in a specific zone Includes paging parameters to limit size of results returned.ScriptGroup[]searchGroupsInZone(java.lang.String shortNameFilter, java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy)Search for groups in a specific zone Includes paging parameters to limit size of results returned.ScriptGroup[]searchRootGroups(java.lang.String displayNamePattern)Search the root groups, those without a parent group.ScriptGroup[]searchRootGroups(java.lang.String displayNamePattern, ScriptPagingDetails paging, java.lang.String sortBy)Search the root groups, those without a parent group.ScriptGroup[]searchRootGroupsInZone(java.lang.String displayNamePattern, java.lang.String zone)Search the root groups, those without a parent group.ScriptGroup[]searchRootGroupsInZone(java.lang.String displayNamePattern, java.lang.String zone, int maxItems, int skipCount)Search the root groups, those without a parent group.ScriptGroup[]searchRootGroupsInZone(java.lang.String displayNamePattern, java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy)Search the root groups, those without a parent group.ScriptUser[]searchUsers(java.lang.String nameFilter, ScriptPagingDetails paging, java.lang.String sortBy)Deprecated.see People.getPeople(String filter, ScriptPagingDetails pagingRequest, String sortBy)voidsetServiceRegistry(ServiceRegistry serviceRegistry)-
Methods inherited from class org.alfresco.repo.jscript.BaseScopableProcessorExtension
getScope, setScope
-
Methods inherited from class org.alfresco.repo.processor.BaseProcessorExtension
getExtensionName, register, setExtensionName, setProcessor
-
-
-
-
Field Detail
-
ON_FIRST_SPACE
public static final java.lang.String ON_FIRST_SPACE
RegEx to split a String on the first space.- See Also:
- Constant Field Values
-
-
Method Detail
-
setServiceRegistry
public void setServiceRegistry(ServiceRegistry serviceRegistry)
-
getAuthorityService
public AuthorityService getAuthorityService()
-
searchRootGroupsInZone
public ScriptGroup[] searchRootGroupsInZone(java.lang.String displayNamePattern, java.lang.String zone)
Search the root groups, those without a parent group.- Returns:
- The root groups (empty if there are no root groups)
-
searchRootGroupsInZone
public ScriptGroup[] searchRootGroupsInZone(java.lang.String displayNamePattern, java.lang.String zone, int maxItems, int skipCount)
Search the root groups, those without a parent group.- Parameters:
maxItems- Maximum number of items returned.skipCount- number of items to skip.- Returns:
- The root groups (empty if there are no root groups)
-
searchRootGroupsInZone
public ScriptGroup[] searchRootGroupsInZone(java.lang.String displayNamePattern, java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy)
Search the root groups, those without a parent group.- Parameters:
paging- Paging object with max number to return, and items to skipsortBy- What to sort on (authorityName, shortName or displayName)- Returns:
- The root groups (empty if there are no root groups)
-
searchRootGroups
public ScriptGroup[] searchRootGroups(java.lang.String displayNamePattern)
Search the root groups, those without a parent group.- Returns:
- The root groups (empty if there are no root groups)
-
searchRootGroups
public ScriptGroup[] searchRootGroups(java.lang.String displayNamePattern, ScriptPagingDetails paging, java.lang.String sortBy)
Search the root groups, those without a parent group.- Parameters:
paging- Paging object with max number to return, and items to skipsortBy- What to sort on (authorityName, shortName or displayName)- Returns:
- The root groups (empty if there are no root groups)
-
getAllRootGroups
public ScriptGroup[] getAllRootGroups()
Search the root groups, those without a parent group. Searches in all zones.- Returns:
- The root groups (empty if there are no root groups)
-
getAllRootGroups
public ScriptGroup[] getAllRootGroups(int maxItems, int skipCount)
Search the root groups, those without a parent group. Searches in all zones.- Returns:
- The root groups (empty if there are no root groups)
-
getAllRootGroups
public ScriptGroup[] getAllRootGroups(ScriptPagingDetails paging)
Search the root groups, those without a parent group. Searches in all zones.- Returns:
- The root groups (empty if there are no root groups)
-
getAllRootGroupsInZone
public ScriptGroup[] getAllRootGroupsInZone(java.lang.String zone)
Get the root groups, those without a parent group.- Parameters:
zone- zone to search in.- Returns:
- The root groups (empty if there are no root groups)
-
getAllRootGroupsInZone
public ScriptGroup[] getAllRootGroupsInZone(java.lang.String zone, int maxItems, int skipCount)
Get the root groups, those without a parent group.- Parameters:
zone- zone to search in.maxItems- Maximum number of items returned.skipCount- number of items to skip.- Returns:
- The root groups (empty if there are no root groups)
-
getAllRootGroupsInZone
public ScriptGroup[] getAllRootGroupsInZone(java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy)
Get the root groups, those without a parent group.- Parameters:
zone- zone to search in.paging- Paging object with max number to return, and items to skipsortBy- What to sort on (authorityName, shortName or displayName)- Returns:
- The root groups (empty if there are no root groups)
-
getGroups
public ScriptGroup[] getGroups(java.lang.String filter, ScriptPagingDetails paging)
Retreives groups matching the given filter from all zones. NOTE: If the filter is null, an empty string or * all groups found will be returned. If the filter starts with * or contains a ? character results returned could be inconsistent.- Parameters:
filter- Pattern to filter groups bypaging- Paging details- Returns:
- Array of matching groups
- Since:
- 4.0
-
getGroups
public ScriptGroup[] getGroups(java.lang.String filter, ScriptPagingDetails paging, java.lang.String sortBy)
Retreives groups matching the given filter from all zones. NOTE: If the filter is null, an empty string or * all groups found will be returned. If the filter starts with * or contains a ? character results returned could be inconsistent.- Parameters:
filter- Pattern to filter groups bypaging- Paging detailssortBy- Field to sort by, can beshortNameordisplayNameotherwise the results are ordered by the authorityName- Returns:
- Array of matching groups
- Since:
- 4.0
-
getGroupsInZone
public ScriptGroup[] getGroupsInZone(java.lang.String filter, java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy)
Deprecated.- Since:
- 4.0
-
getGroupsInZone
public ScriptGroup[] getGroupsInZone(java.lang.String filter, java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy, boolean sortAsc)
Retrieves groups matching the given filter from the given zone. NOTE: If the filter is null, an empty string or * all groups found will be returned.- Parameters:
filter- Pattern to filter groups byzone- The zone in which to search for groupspaging- Paging detailssortBy- Field to sort by, can beshortName,displayNameorauthorityName, the default is displayNamesortAsc- sort ascending or not- Returns:
- Array of matching groups
- Since:
- 4.1.4
-
getGroup
public ScriptGroup getGroup(java.lang.String shortName)
Get a group given its short name- Parameters:
shortName- the shortName of the group- Returns:
- the authority or null if it can't be found
-
getGroupForFullAuthorityName
public ScriptGroup getGroupForFullAuthorityName(java.lang.String fullAuthorityName)
Get a group given it full authority name (Which must begin with 'GROUP_'- Parameters:
fullAuthorityName- the shortName of the group- Returns:
- the authority or null if it can't be found
-
createRootGroup
public ScriptGroup createRootGroup(java.lang.String shortName, java.lang.String displayName)
Create a new root group in the default application zones- Returns:
- the new root group.
-
searchGroups
public ScriptGroup[] searchGroups(java.lang.String shortNameFilter)
Search for groups in all zones.- Parameters:
shortNameFilter- partial match on shortName (* and ?) work. If empty then matches everything.- Returns:
- the groups matching the query
-
searchGroups
public ScriptGroup[] searchGroups(java.lang.String shortNameFilter, ScriptPagingDetails paging, java.lang.String sortBy)
Search for groups in all zones.- Parameters:
shortNameFilter- partial match on shortName (* and ?) work. If empty then matches everything.paging- Paging object with max number to return, and items to skipsortBy- What to sort on (authorityName, shortName or displayName)- Returns:
- the groups matching the query
-
searchGroupsInZone
public ScriptGroup[] searchGroupsInZone(java.lang.String shortNameFilter, java.lang.String zone)
Search for groups in a specific zone- Parameters:
shortNameFilter- partial match on shortName (* and ?) work. If empty then matches everything.zone- zone to search in.- Returns:
- the groups matching the query
-
searchGroupsInZone
public ScriptGroup[] searchGroupsInZone(java.lang.String shortNameFilter, java.lang.String zone, int maxItems, int skipCount)
Search for groups in a specific zone Includes paging parameters to limit size of results returned.- Parameters:
shortNameFilter- partial match on shortName (* and ?) work. If empty then matches everything.zone- zone to search in.maxItems- Maximum number of items returned.skipCount- number of items to skip.- Returns:
- the groups matching the query
-
searchGroupsInZone
public ScriptGroup[] searchGroupsInZone(java.lang.String shortNameFilter, java.lang.String zone, ScriptPagingDetails paging, java.lang.String sortBy)
Search for groups in a specific zone Includes paging parameters to limit size of results returned.- Parameters:
shortNameFilter- partial match on shortName (* and ?) work. If empty then matches everything.zone- zone to search in.paging- Paging object with max number to return, and items to skipsortBy- What to sort on (authorityName, shortName or displayName)- Returns:
- the groups matching the query
-
getUser
public ScriptUser getUser(java.lang.String username)
Get a user given their username- Parameters:
username- the username of the user- Returns:
- the user or null if they can't be found
-
searchUsers
public ScriptUser[] searchUsers(java.lang.String nameFilter, ScriptPagingDetails paging, java.lang.String sortBy)
Deprecated.see People.getPeople(String filter, ScriptPagingDetails pagingRequest, String sortBy)Search for users Includes paging parameters to limit size of results returned.- Parameters:
nameFilter- partial match of the name (username, first name, last name). If empty then matches everyone.paging- Paging object with max number to return, and items to skipsortBy- What to sort on (firstName, lastName or userName)- Returns:
- the users matching the query
-
-