public class AuthorityServiceImpl extends Object implements AuthorityService, org.springframework.beans.factory.InitializingBean
| Modifier and Type | Class and Description |
|---|---|
class |
AuthorityServiceImpl.UserAuthoritySet
Lazy load set of authorities.
|
AuthorityService.AuthorityFilterZONE_APP_DEFAULT, ZONE_APP_SHARE, ZONE_AUTH_ALFRESCO, ZONE_AUTH_EXT_PREFIX| Constructor and Description |
|---|
AuthorityServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAuthority(Collection<String> parentNames,
String childName)
Set a given child authority to be included by the given parent authorities.
|
void |
addAuthority(String parentName,
String childName)
Set an authority to include another authority.
|
void |
addAuthorityToZones(String authorityName,
Set<String> zones)
Add a zone to an authority.
|
void |
afterPropertiesSet() |
boolean |
authorityExists(String name)
Check if an authority exists.
|
long |
countGroups()
Count the number of users (not groups)
|
long |
countUsers()
Count the number of groups
|
String |
createAuthority(org.alfresco.service.cmr.security.AuthorityType type,
String shortName)
Create an authority.
|
String |
createAuthority(org.alfresco.service.cmr.security.AuthorityType type,
String shortName,
String authorityDisplayName,
Set<String> authorityZones)
Create an authority with a display name and zone.
|
void |
deleteAuthority(String name)
Delete an authority and all its relationships.
|
void |
deleteAuthority(String name,
boolean cascade)
Delete an authority and all its relationships, optionally recursively deleting child authorities of the same
type.
|
Set<String> |
findAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
String parentAuthority,
boolean immediate,
String displayNamePattern,
String zoneName)
Search for authorities by pattern matching (* and ?) against the authority name.
|
Set<String> |
getAllAuthorities(org.alfresco.service.cmr.security.AuthorityType type)
Get all authorities by type
See also "getAuthorities" (paged) alternative
|
Set<String> |
getAllAuthoritiesInZone(String zoneName,
org.alfresco.service.cmr.security.AuthorityType type)
Gets the names of all authorities in a zone, optionally filtered by type
See also "getAuthorities" paged alternative (note: in that case, zone must exist)
|
Set<String> |
getAllRootAuthorities(org.alfresco.service.cmr.security.AuthorityType type)
Get all root authorities by type.
|
Set<String> |
getAllRootAuthoritiesInZone(String zoneName,
org.alfresco.service.cmr.security.AuthorityType type)
Gets the names of all root authorities in a zone, optionally filtered by type.
|
Set<String> |
getAuthorities()
Get the authorities for the current user
|
org.alfresco.query.PagingResults<String> |
getAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
String zoneName,
String displayNameFilter,
boolean sortByDisplayName,
boolean sortAscending,
org.alfresco.query.PagingRequest pagingRequest)
Get authorities by type and/or zone
|
Set<String> |
getAuthoritiesForUser(String currentUserName)
Get the authorities for the given user
|
org.alfresco.query.PagingResults<AuthorityInfo> |
getAuthoritiesInfo(org.alfresco.service.cmr.security.AuthorityType type,
String zoneName,
String displayNameFilter,
String sortBy,
boolean sortAscending,
org.alfresco.query.PagingRequest pagingRequest)
Get authorities by type and/or zone
|
String |
getAuthorityDisplayName(String name)
Get the display name for the given authority.
|
org.alfresco.service.cmr.repository.NodeRef |
getAuthorityNodeRef(String name)
Gets the authority node for the specified name
|
Set<String> |
getAuthorityZones(String name)
Gets the name of the zone containing the specified authority.
|
Set<String> |
getContainedAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
String name,
boolean immediate)
Get all the authorities that are contained by the given authority.
|
Set<String> |
getContainingAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
String name,
boolean immediate)
Get the authorities that contain the given authority,
but use
getAuthoritiesForUser(userName).contains(authority) rather than
getContainingAuthorities(type, userName, false).contains(authority) or
use AuthorityService.getContainingAuthoritiesInZone(AuthorityType, String, String, AuthorityFilter, int)
as they will be much faster. |
Set<String> |
getContainingAuthoritiesInZone(org.alfresco.service.cmr.security.AuthorityType type,
String authority,
String zoneName,
AuthorityService.AuthorityFilter filter,
int size)
Get a set of authorities with varying filter criteria
|
Set<String> |
getDefaultZones()
Get the name of the default zone.
|
String |
getName(org.alfresco.service.cmr.security.AuthorityType type,
String shortName)
Create the full identifier for an authority given its short name and
type.
|
org.alfresco.service.cmr.repository.NodeRef |
getOrCreateZone(String zoneName)
Gets or creates an authority zone node with the specified name
|
String |
getShortName(String name)
Extract the short name of an authority from its full identifier.
|
org.alfresco.service.cmr.repository.NodeRef |
getZone(String zoneName)
Gets an authority zone node with the specified name
|
boolean |
hasAdminAuthority()
Check of the current user has admin authority.
|
boolean |
hasGuestAuthority()
Check of the current user has guest authority.
|
void |
init() |
boolean |
isAdminAuthority(String authorityName)
Does the given authority have admin authority.
|
boolean |
isGuestAuthority(String authorityName)
Does the given authority have guest authority.
|
void |
removeAuthority(String parentName,
String childName)
Remove an authority as a member of another authority.
|
void |
removeAuthorityFromZones(String authorityName,
Set<String> zones)
Remove a zone from an authority
|
void |
setAdminGroups(Set<String> adminGroups) |
void |
setAuthenticationService(AuthenticationService authenticationService) |
void |
setAuthorityDAO(AuthorityDAO authorityDAO) |
void |
setAuthorityDisplayName(String authorityName,
String authorityDisplayName)
Set the display name for the given authority.
|
void |
setGuestGroups(Set<String> guestGroups) |
void |
setPermissionServiceSPI(PermissionServiceSPI permissionServiceSPI) |
void |
setPersonService(PersonService personService) |
void |
setPolicyComponent(PolicyComponent policyComponent) |
void |
setTenantService(org.alfresco.repo.tenant.TenantService tenantService) |
void |
setUserNameMatcher(UserNameMatcher userNameMatcher) |
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
public void setPersonService(PersonService personService)
public void setAuthorityDAO(AuthorityDAO authorityDAO)
public void setUserNameMatcher(UserNameMatcher userNameMatcher)
public void setAuthenticationService(AuthenticationService authenticationService)
public void setPermissionServiceSPI(PermissionServiceSPI permissionServiceSPI)
public void setPolicyComponent(PolicyComponent policyComponent)
public void init()
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic boolean hasAdminAuthority()
hasAdminAuthority in interface AuthorityServicepublic boolean isAdminAuthority(String authorityName)
isAdminAuthority in interface AuthorityServiceauthorityName - The name of the authority.public boolean hasGuestAuthority()
hasGuestAuthority in interface AuthorityServicepublic boolean isGuestAuthority(String authorityName)
isGuestAuthority in interface AuthorityServiceauthorityName - The name of the authority.public long countUsers()
AuthorityServicecountUsers in interface AuthorityServicepublic long countGroups()
AuthorityServicecountGroups in interface AuthorityServicepublic Set<String> getAuthorities()
getAuthorities in interface AuthorityServicepublic Set<String> getAuthoritiesForUser(String currentUserName)
getAuthoritiesForUser in interface AuthorityServicepublic Set<String> getAllAuthorities(org.alfresco.service.cmr.security.AuthorityType type)
getAllAuthorities in interface AuthorityServicetype - the type of authorities - cannot be null(paged)public org.alfresco.query.PagingResults<AuthorityInfo> getAuthoritiesInfo(org.alfresco.service.cmr.security.AuthorityType type, String zoneName, String displayNameFilter, String sortBy, boolean sortAscending, org.alfresco.query.PagingRequest pagingRequest)
getAuthoritiesInfo in interface AuthorityServicetype - the type of authorities (note: mandatory if zoneName is null)zoneName - the zoneName (note: mandatory if type is null)displayNameFilter - optional filter (startsWith / ignoreCase) for authority display name (note: implied trailing "*")sortBy - either "displayName", "shortName", "authorityName" or null if no sorting.
note: for users, displayName/shortName is equivalent to the userName, for groups if the display is null then use the short namesortAscending - if true then sort ascending else sort descending (ignore if sortByDisplayName is false)pagingRequest - the requested page (skipCount, maxItems, queryExectionId)public org.alfresco.query.PagingResults<String> getAuthorities(org.alfresco.service.cmr.security.AuthorityType type, String zoneName, String displayNameFilter, boolean sortByDisplayName, boolean sortAscending, org.alfresco.query.PagingRequest pagingRequest)
getAuthorities in interface AuthorityServicetype - the type of authorities (note: mandatory if zoneName is null)zoneName - the zoneName (note: mandatory if type is null)displayNameFilter - optional filter (startsWith / ignoreCase) for authority display name (note: implied trailing "*")sortByDisplayName - if true then sort (ignoring case) by the authority display name, if false then unsorted
note: for users, displayName/shortName is equivalent to the userName, for groups if the display is null then use the short namesortAscending - if true then sort ascending else sort descending (ignore if sortByDisplayName is false)pagingRequest - the requested page (skipCount, maxItems, queryExectionId)public void addAuthority(String parentName, String childName)
addAuthority in interface AuthorityServiceparentName - -
the full name string identifier for the parent.childName - -
the string identifier for the child.public void addAuthority(Collection<String> parentNames, String childName)
addAuthority in interface AuthorityServiceparentNames - -
the full name string identifier for the parents.childName - -
the string identifier for the child.public String createAuthority(org.alfresco.service.cmr.security.AuthorityType type, String shortName)
createAuthority in interface AuthorityServicetype - -
the type of the authorityshortName - -
the short name of the authority to create
this will also be set as the default display name for the authoritypublic void deleteAuthority(String name)
deleteAuthority in interface AuthorityServicename - Stringpublic void deleteAuthority(String name, boolean cascade)
deleteAuthority in interface AuthorityServicename - the authority long namecascade - should the delete be cascaded to child authorities of the same type?public Set<String> getAllRootAuthorities(org.alfresco.service.cmr.security.AuthorityType type)
getAllRootAuthorities in interface AuthorityServicetype - -
the type of the authoritypublic Set<String> getContainedAuthorities(org.alfresco.service.cmr.security.AuthorityType type, String name, boolean immediate)
getContainedAuthorities in interface AuthorityServicetype - -
if not null, limit to the type of authority specifiedname - -
the name of the containing authorityimmediate - -
if true, limit the depth to just immediate child, if false
find authorities at any depthpublic Set<String> getContainingAuthorities(org.alfresco.service.cmr.security.AuthorityType type, String name, boolean immediate)
getAuthoritiesForUser(userName).contains(authority) rather than
getContainingAuthorities(type, userName, false).contains(authority) or
use AuthorityService.getContainingAuthoritiesInZone(AuthorityType, String, String, AuthorityFilter, int)
as they will be much faster.
For example, this method can be used find out all the authorities that contain a
group.getContainingAuthorities in interface AuthorityServicetype - -
if not null, limit to the type of authority specifiedname - -
the name of the authority for which the containing authorities
are required.immediate - -
limit to immediate parents or any ancestor.public org.alfresco.service.cmr.repository.NodeRef getAuthorityNodeRef(String name)
getAuthorityNodeRef in interface AuthorityServicename - The authority namepublic Set<String> getContainingAuthoritiesInZone(org.alfresco.service.cmr.security.AuthorityType type, String authority, String zoneName, AuthorityService.AuthorityFilter filter, int size)
getContainingAuthoritiesInZone in interface AuthorityServicetype - authority type or null for all typesauthority - if non-null, only return those authorities who contain this authorityzoneName - if non-null, only include authorities in the named zonefilter - optional callback to apply further filter criteria or nullsize - if greater than zero, the maximum results to return. The search strategy used is varied depending on
this number.public void removeAuthority(String parentName, String childName)
AuthorityServiceremoveAuthority in interface AuthorityServiceparentName - -
the string identifier for the parent.childName - -
the string identifier for the child.public boolean authorityExists(String name)
authorityExists in interface AuthorityServicename - (the long name).public String createAuthority(org.alfresco.service.cmr.security.AuthorityType type, String shortName, String authorityDisplayName, Set<String> authorityZones)
createAuthority in interface AuthorityServicetype - the type of the authorityshortName - the short name of the authority to createauthorityDisplayName - the display name for the authorityauthorityZones - identifier for external user registry owning the authority or null if not applicablepublic String getAuthorityDisplayName(String name)
getAuthorityDisplayName in interface AuthorityServicename - - the full authority string including any prefix (e.g. GROUP_woof)public void setAuthorityDisplayName(String authorityName, String authorityDisplayName)
setAuthorityDisplayName in interface AuthorityServiceauthorityName - StringauthorityDisplayName - Stringpublic Set<String> getAuthorityZones(String name)
getAuthorityZones in interface AuthorityServicename - the authority long nameAuthorityService.ZONE_APP_DEFAULT if the
authority exists but has no zone, or null if the authority does not exist.public org.alfresco.service.cmr.repository.NodeRef getOrCreateZone(String zoneName)
getOrCreateZone in interface AuthorityServicezoneName - the zone namepublic org.alfresco.service.cmr.repository.NodeRef getZone(String zoneName)
getZone in interface AuthorityServicezoneName - the zone namepublic Set<String> getAllAuthoritiesInZone(String zoneName, org.alfresco.service.cmr.security.AuthorityType type)
getAllAuthoritiesInZone in interface AuthorityServicezoneName - the zone name - note: if zone does not exist then will currently return empty settype - the authority type to filter by or null for all authority types(paged)public void addAuthorityToZones(String authorityName, Set<String> zones)
addAuthorityToZones in interface AuthorityServiceauthorityName - Stringpublic void removeAuthorityFromZones(String authorityName, Set<String> zones)
removeAuthorityFromZones in interface AuthorityServiceauthorityName - Stringpublic Set<String> getDefaultZones()
getDefaultZones in interface AuthorityServicepublic Set<String> getAllRootAuthoritiesInZone(String zoneName, org.alfresco.service.cmr.security.AuthorityType type)
getAllRootAuthoritiesInZone in interface AuthorityServicezoneName - the zone nametype - the authority type to filter by or null for all authority typespublic Set<String> findAuthorities(org.alfresco.service.cmr.security.AuthorityType type, String parentAuthority, boolean immediate, String displayNamePattern, String zoneName)
findAuthorities in interface AuthorityServicetype - AuthorityTypeparentAuthority - if non-null, will look only for authorities who are a child of the named parentimmediate - if true then only search root groups if parentAuthority is null, or immediate children of parentAuthority if it is non-null.displayNamePattern - StringzoneName - - may be null to indicate all zonespublic String getName(org.alfresco.service.cmr.security.AuthorityType type, String shortName)
getName in interface AuthorityServicetype - AuthorityTypeshortName - Stringpublic String getShortName(String name)
getShortName in interface AuthorityServicename - StringCopyright © 2005–2018 Alfresco Software. All rights reserved.