public interface AuthorityService
| Modifier and Type | Interface and Description |
|---|---|
static interface |
AuthorityService.AuthorityFilter |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ZONE_APP_DEFAULT
The default application zone.
|
static java.lang.String |
ZONE_APP_SHARE
The SHARE application zone.
|
static java.lang.String |
ZONE_APP_WCM
The WCM application zone.
|
static java.lang.String |
ZONE_AUTH_ALFRESCO
Default authentication
|
static java.lang.String |
ZONE_AUTH_EXT_PREFIX
Prefix for external auth ids
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAuthority(java.util.Collection parentNames,
java.lang.String childName)
Set a given child authority to be included by the given parent authorities.
|
void |
addAuthority(java.lang.String parentName,
java.lang.String childName)
Set an authority to include another authority.
|
void |
addAuthorityToZones(java.lang.String authorityName,
java.util.Set zones)
Add a zone to an authority.
|
boolean |
authorityExists(java.lang.String name)
Check if an authority exists.
|
java.lang.String |
createAuthority(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String shortName)
Create an authority.
|
java.lang.String |
createAuthority(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String shortName,
java.lang.String authorityDisplayName,
java.util.Set authorityZones)
Create an authority with a display name and zone.
|
void |
deleteAuthority(java.lang.String name)
Delete an authority and all its relationships.
|
void |
deleteAuthority(java.lang.String name,
boolean cascade)
Delete an authority and all its relationships, optionally recursively deleting child authorities of the same
type.
|
java.util.Set |
findAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String parentAuthority,
boolean immediate,
java.lang.String displayNamePattern,
java.lang.String zoneName)
Search for authorities by pattern matching (* and ?) against the authority name.
|
java.util.Set |
getAllAuthorities(org.alfresco.service.cmr.security.AuthorityType type)
Get all authorities by type
See also "getAuthorities" (paged) alternative
|
java.util.Set |
getAllAuthoritiesInZone(java.lang.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)
|
java.util.Set |
getAllRootAuthorities(org.alfresco.service.cmr.security.AuthorityType type)
Get all root authorities by type.
|
java.util.Set |
getAllRootAuthoritiesInZone(java.lang.String zoneName,
org.alfresco.service.cmr.security.AuthorityType type)
Gets the names of all root authorities in a zone, optionally filtered by type.
|
java.util.Set |
getAuthorities()
Get the authorities for the current user
|
org.alfresco.query.PagingResults |
getAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String zoneName,
java.lang.String displayNameFilter,
boolean sortByDisplayName,
boolean sortAscending,
org.alfresco.query.PagingRequest pagingRequest)
Get authorities by type and/or zone
|
java.util.Set |
getAuthoritiesForUser(java.lang.String userName)
Get the authorities for the given user
|
java.lang.String |
getAuthorityDisplayName(java.lang.String name)
Get the display name for the given authority.
|
org.alfresco.service.cmr.repository.NodeRef |
getAuthorityNodeRef(java.lang.String name)
Gets the authority node for the specified name
|
java.util.Set |
getAuthorityZones(java.lang.String name)
Gets the name of the zone containing the specified authority.
|
java.util.Set |
getContainedAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String name,
boolean immediate)
Get all the authorities that are contained by the given authority.
|
java.util.Set |
getContainingAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.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 #getContainingAuthoritiesInZone(AuthorityType, String, AuthorityService.ZONE_APP_DEFAULT)
as they will be much faster. |
java.util.Set |
getContainingAuthoritiesInZone(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String name,
java.lang.String zoneName,
AuthorityService.AuthorityFilter filter,
int size)
Get a set of authorities with varying filter criteria
|
java.util.Set |
getDefaultZones()
Get the name of the default zone.
|
java.lang.String |
getName(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String shortName)
Create the full identifier for an authority given its short name and
type.
|
org.alfresco.service.cmr.repository.NodeRef |
getOrCreateZone(java.lang.String zoneName)
Gets or creates an authority zone node with the specified name
|
java.lang.String |
getShortName(java.lang.String name)
Extract the short name of an authority from its full identifier.
|
org.alfresco.service.cmr.repository.NodeRef |
getZone(java.lang.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.
|
boolean |
isAdminAuthority(java.lang.String authorityName)
Does the given authority have admin authority.
|
boolean |
isGuestAuthority(java.lang.String authorityName)
Does the given authority have guest authority.
|
void |
removeAuthority(java.lang.String parentName,
java.lang.String childName)
Remove an authority as a member of another authority.
|
void |
removeAuthorityFromZones(java.lang.String authorityName,
java.util.Set zones)
Remove a zone from an authority
|
void |
setAuthorityDisplayName(java.lang.String authorityName,
java.lang.String authorityDisplayName)
Set the display name for the given authority.
|
static final java.lang.String ZONE_APP_DEFAULT
static final java.lang.String ZONE_APP_WCM
static final java.lang.String ZONE_APP_SHARE
static final java.lang.String ZONE_AUTH_ALFRESCO
static final java.lang.String ZONE_AUTH_EXT_PREFIX
@Auditable boolean hasAdminAuthority()
@Auditable(parameters="authorityName") boolean isAdminAuthority(java.lang.String authorityName)
authorityName - The name of the authority.@Auditable boolean hasGuestAuthority()
@Auditable(parameters="authorityName") boolean isGuestAuthority(java.lang.String authorityName)
authorityName - The name of the authority.@Auditable java.util.Set getAuthorities()
@Auditable(parameters="userName") java.util.Set getAuthoritiesForUser(java.lang.String userName)
@Auditable(parameters="type") java.util.Set getAllAuthorities(org.alfresco.service.cmr.security.AuthorityType type)
type - the type of authorities - cannot be null(paged)@Auditable(parameters={"type", "zoneName", "displayNameFilter", "sortByDisplayName", "sortAscending", "pagingRequest"})
org.alfresco.query.PagingResults getAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String zoneName,
java.lang.String displayNameFilter,
boolean sortByDisplayName,
boolean sortAscending,
org.alfresco.query.PagingRequest pagingRequest)
type - 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)UnknownAuthorityException - - if zoneName is not null and does not exist@Auditable(parameters="type") java.util.Set getAllRootAuthorities(org.alfresco.service.cmr.security.AuthorityType type)
type - -
the type of the authority@Auditable(parameters={"type", "shortName"})
java.lang.String createAuthority(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String shortName)
type - -
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 authority@Auditable(parameters={"type", "shortName", "authorityDisplayName", "authorityZones"})
java.lang.String createAuthority(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String shortName,
java.lang.String authorityDisplayName,
java.util.Set authorityZones)
type - the type of the authorityshortName - the short name of the authority to createauthorityDisplayName - the display name for the authorityauthorityZone - identifier for external user registry owning the authority or null if not applicable@Auditable(parameters={"parentName", "childName"})
void addAuthority(java.lang.String parentName,
java.lang.String childName)
parentName - -
the full name string identifier for the parent.childName - -
the string identifier for the child.@Auditable(parameters={"parentNames", "childName"})
void addAuthority(java.util.Collection parentNames,
java.lang.String childName)
parentNames - -
the full name string identifier for the parents.childName - -
the string identifier for the child.@Auditable(parameters={"parentName", "childName"})
void removeAuthority(java.lang.String parentName,
java.lang.String childName)
parentName - -
the string identifier for the parent.childName - -
the string identifier for the child.@Auditable(parameters="name") void deleteAuthority(java.lang.String name)
name - @Auditable(parameters={"name", "cascade"})
void deleteAuthority(java.lang.String name,
boolean cascade)
name - the authority long namecascade - should the delete be cascaded to child authorities of the same type?@Auditable(parameters={"type", "name", "immediate"})
java.util.Set getContainedAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String name,
boolean immediate)
type - -
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 depth@Auditable(parameters={"type", "name", "immediate"})
java.util.Set getContainingAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String name,
boolean immediate)
getAuthoritiesForUser(userName).contains(authority) rather than
getContainingAuthorities(type, userName, false).contains(authority) or
use #getContainingAuthoritiesInZone(AuthorityType, String, AuthorityService.ZONE_APP_DEFAULT)
as they will be much faster.
For example, this method can be used find out all the authorities that contain a
group.type - -
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.@Auditable(parameters={"type", "name", "zoneName", "filter", "size"})
java.util.Set getContainingAuthoritiesInZone(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String name,
java.lang.String zoneName,
AuthorityService.AuthorityFilter filter,
int size)
type - authority type or null for all typesname - 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.@Auditable(parameters="name") java.lang.String getShortName(java.lang.String name)
name - @Auditable(parameters={"type", "shortName"})
java.lang.String getName(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String shortName)
type - shortName - @Auditable(parameters="name") boolean authorityExists(java.lang.String name)
name - (the long name).@Auditable(parameters="name") java.lang.String getAuthorityDisplayName(java.lang.String name)
name - - the full authority string including any prefix (e.g. GROUP_woof)@Auditable(parameters={"authorityName", "authorityDisplayName"})
void setAuthorityDisplayName(java.lang.String authorityName,
java.lang.String authorityDisplayName)
authorityName - authorityDisplayName - @Auditable(parameters="name") org.alfresco.service.cmr.repository.NodeRef getAuthorityNodeRef(java.lang.String name)
name - The authority name@Auditable(parameters="zoneName") org.alfresco.service.cmr.repository.NodeRef getOrCreateZone(java.lang.String zoneName)
zoneName - the zone name@Auditable(parameters="zoneName") org.alfresco.service.cmr.repository.NodeRef getZone(java.lang.String zoneName)
zoneName - the zone name@Auditable(parameters="name") java.util.Set getAuthorityZones(java.lang.String name)
name - the authority long nameAuthorityService#DEFAULT_ZONE if the
authority exists but has no zone, or null if the authority does not exist.@Auditable(parameters={"zoneName", "type"})
java.util.Set getAllAuthoritiesInZone(java.lang.String zoneName,
org.alfresco.service.cmr.security.AuthorityType type)
zoneName - 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)@Auditable(parameters={"zoneName", "type"})
java.util.Set getAllRootAuthoritiesInZone(java.lang.String zoneName,
org.alfresco.service.cmr.security.AuthorityType type)
zoneName - the zone nametype - the authority type to filter by or null for all authority types@Auditable(parameters={"authorityName", "zones"})
void addAuthorityToZones(java.lang.String authorityName,
java.util.Set zones)
authorityName - zone - @Auditable(parameters={"authorityName", "zones"})
void removeAuthorityFromZones(java.lang.String authorityName,
java.util.Set zones)
authorityName - zone - @NotAuditable java.util.Set getDefaultZones()
@Auditable(parameters="type")
java.util.Set findAuthorities(org.alfresco.service.cmr.security.AuthorityType type,
java.lang.String parentAuthority,
boolean immediate,
java.lang.String displayNamePattern,
java.lang.String zoneName)
type - parentAuthority - 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 - zoneName - - may be null to indicate all zonesCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.