Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.service.cmr.security
Interface AuthorityService

@org.alfresco.api.AlfrescoPublicApi
public interface AuthorityService
The service that encapsulates authorities granted to users. This service will refuse to create any user authorities. These should be managed using the AuthenticationService and PersonServce. Methods that try to change alter users will throw an exception. A string key is used to identify the authority. These follow the contract defined in AuthorityType. If there are entities linked to these authorities this key should be used to find them, as userName is used link user and person.
Author:
Andy Hind

Field Summary
ZONE_APP_DEFAULT
          The default application zone.
ZONE_APP_SHARE
          The SHARE application zone.
ZONE_AUTH_ALFRESCO
          Default authentication
ZONE_AUTH_EXT_PREFIX
          Prefix for external auth ids
Method Summary
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.
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
createAuthority(AuthorityType type, String shortName)
          Create an authority.
createAuthority(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.
findAuthorities(AuthorityType type, String parentAuthority, boolean immediate, String displayNamePattern, String zoneName)
          Search for authorities by pattern matching (* and ?) against the authority name.
getAllAuthorities(AuthorityType type)
getAllAuthoritiesInZone(String zoneName, 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)
getAllRootAuthorities(AuthorityType type)
          Get all root authorities by type.
getAllRootAuthoritiesInZone(String zoneName, AuthorityType type)
          Gets the names of all root authorities in a zone, optionally filtered by type.
getAuthorities()
          Get the authorities for the current user
getAuthorities(AuthorityType type, String zoneName, String displayNameFilter, boolean sortByDisplayName, boolean sortAscending, PagingRequest pagingRequest)
          Get authorities by type and/or zone
getAuthoritiesForUser(String userName)
          Get the authorities for the given user
getAuthoritiesInfo(AuthorityType type, String zoneName, String displayNameFilter, String sortBy, boolean sortAscending, PagingRequest pagingRequest)
          Get authorities by type and/or zone
getAuthorityDisplayName(String name)
          Get the display name for the given authority.
getAuthorityNodeRef(String name)
          Gets the authority node for the specified name
getAuthorityZones(String name)
          Gets the name of the zone containing the specified authority.
getContainedAuthorities(AuthorityType type, String name, boolean immediate)
          Get all the authorities that are contained by the given authority.
getContainingAuthorities(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 getContainingAuthoritiesInZone(AuthorityType, String, String, AuthorityFilter, int) as they will be much faster.
getContainingAuthoritiesInZone(AuthorityType type, String name, String zoneName, org.alfresco.service.cmr.security.AuthorityService.AuthorityFilter filter, int size)
          Get a set of authorities with varying filter criteria
getDefaultZones()
          Get the name of the default zone.
getName(AuthorityType type, String shortName)
          Create the full identifier for an authority given its short name and type.
getOrCreateZone(String zoneName)
          Gets or creates an authority zone node with the specified name
getShortName(String name)
          Extract the short name of an authority from its full identifier.
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.
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
setAuthorityDisplayName(String authorityName, String authorityDisplayName)
          Set the display name for the given authority.
Field Detail
ZONE_APP_DEFAULT
public static final String ZONE_APP_DEFAULT
The default application zone.
See Also:
Constant Field Values

ZONE_APP_SHARE
public static final String ZONE_APP_SHARE
The SHARE application zone.
See Also:
Constant Field Values

ZONE_AUTH_ALFRESCO
public static final String ZONE_AUTH_ALFRESCO
Default authentication
See Also:
Constant Field Values

ZONE_AUTH_EXT_PREFIX
public static final String ZONE_AUTH_EXT_PREFIX
Prefix for external auth ids
See Also:
Constant Field Values
Method Detail
hasAdminAuthority
@Auditable
boolean hasAdminAuthority()
Check of the current user has admin authority. There is no contract for who should have this authority, only that it can be tested here. It could be determined by group membership, role, authentication mechanism, ...
Returns:
true if the currently authenticated user has the admin authority

isAdminAuthority
@Auditable(parameters="authorityName")
boolean isAdminAuthority(String authorityName)
Does the given authority have admin authority.
Parameters:
authorityName - The name of the authority.
Returns:
Whether the authority is an 'administrator'.

hasGuestAuthority
@Auditable
boolean hasGuestAuthority()
Check of the current user has guest authority. There is no contract for who should have this authority, only that it can be tested here. It could be determined by group membership, role, authentication mechanism, ...
Returns:
true if the currently authenticated user has the guest authority

isGuestAuthority
@Auditable(parameters="authorityName")
boolean isGuestAuthority(String authorityName)
Does the given authority have guest authority.
Parameters:
authorityName - The name of the authority.
Returns:
Whether the authority is a 'guest'.

countUsers
@Auditable
long countUsers()
Count the number of groups
Returns:
Returns the number of groups

countGroups
@Auditable
long countGroups()
Count the number of users (not groups)
Returns:
Returns the number of usrs

getAuthorities
@Auditable
Set<StringgetAuthorities()
Get the authorities for the current user
Returns:
authorities for the current user

getAuthoritiesForUser
@Auditable(parameters="userName")
Set<StringgetAuthoritiesForUser(String userName)
Get the authorities for the given user

getAllAuthorities
@Auditable(parameters="type")
@Deprecated
Set<StringgetAllAuthorities(AuthorityType type)
Deprecated. use getAuthorities(AuthorityType, String, String, boolean, boolean, PagingRequest) at least
Get all authorities by type See also "getAuthorities" (paged) alternative
Parameters:
type - the type of authorities - cannot be null
Returns:
all authorities by type
See Also:
(paged)

getAuthoritiesInfo
@Auditable(parameters={
  "type",
  "zoneName",
  "displayNameFilter",
  "sortByDisplayName",
  "sortAscending",
  "pagingRequest"
})
PagingResults<AuthorityInfogetAuthoritiesInfo(AuthorityType type,
                                                String zoneName,
                                                String displayNameFilter,
                                                String sortBy,
                                                boolean sortAscending,
                                                PagingRequest pagingRequest)
Get authorities by type and/or zone
Parameters:
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 "*")
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 name
sortAscending - if true then sort ascending else sort descending (ignore if sortByDisplayName is false)
pagingRequest - the requested page (skipCount, maxItems, queryExectionId)
Throws:
org.alfresco.repo.security.authority.UnknownAuthorityException - - if zoneName is not null and does not exist

author janv
Since:
4.0

getAuthorities
@Auditable(parameters={
  "type",
  "zoneName",
  "displayNameFilter",
  "sortByDisplayName",
  "sortAscending",
  "pagingRequest"
})
PagingResults<StringgetAuthorities(AuthorityType type,
                                     String zoneName,
                                     String displayNameFilter,
                                     boolean sortByDisplayName,
                                     boolean sortAscending,
                                     PagingRequest pagingRequest)
Get authorities by type and/or zone
Parameters:
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 name
sortAscending - if true then sort ascending else sort descending (ignore if sortByDisplayName is false)
pagingRequest - the requested page (skipCount, maxItems, queryExectionId)
Throws:
org.alfresco.repo.security.authority.UnknownAuthorityException - - if zoneName is not null and does not exist

author janv
Since:
4.0

getAllRootAuthorities
@Auditable(parameters="type")
Set<StringgetAllRootAuthorities(AuthorityType type)
Get all root authorities by type. Root authorities are ones that were created without an authority as the parent authority;
Parameters:
type - - the type of the authority
Returns:
all root authorities by type.

createAuthority
@Auditable(parameters={
  "type",
  "shortName"
})
String createAuthority(AuthorityType type,
                       String shortName)
Create an authority.
Parameters:
type - - the type of the authority
shortName - - the short name of the authority to create this will also be set as the default display name for the authority
Returns:
the name of the authority (this will be the prefix, if any associated with the type appended with the short name)

createAuthority
@Auditable(parameters={
  "type",
  "shortName",
  "authorityDisplayName",
  "authorityZones"
})
String createAuthority(AuthorityType type,
                       String shortName,
                       String authorityDisplayName,
                       Set<String> authorityZones)
Create an authority with a display name and zone.
Parameters:
type - the type of the authority
shortName - the short name of the authority to create
authorityDisplayName - the display name for the authority
authorityZones - identifier for external user registry owning the authority or null if not applicable
Returns:
the full name of the authority (this will be the prefix, if any associated with the type appended with the short name)

addAuthority
@Auditable(parameters={
  "parentName",
  "childName"
})
void addAuthority(String parentName,
                  String childName)
Set an authority to include another authority. For example, adding a group to a group or adding a user to a group.
Parameters:
parentName - - the full name string identifier for the parent.
childName - - the string identifier for the child.

addAuthority
@Auditable(parameters={
  "parentNames",
  "childName"
})
void addAuthority(Collection<String> parentNames,
                  String childName)
Set a given child authority to be included by the given parent authorities. For example, adding a group to groups or adding a user to groups.
Parameters:
parentNames - - the full name string identifier for the parents.
childName - - the string identifier for the child.

removeAuthority
@Auditable(parameters={
  "parentName",
  "childName"
})
void removeAuthority(String parentName,
                     String childName)
Remove an authority as a member of another authority. The child authority will still exist. If the child authority was not created as a root authority and you remove its creation link, it will be moved to a root authority. If you want rid of it, use delete.
Parameters:
parentName - - the string identifier for the parent.
childName - - the string identifier for the child.

deleteAuthority
@Auditable(parameters="name")
void deleteAuthority(String name)
Delete an authority and all its relationships. Note child authorities are not deleted.
Parameters:
name - String

deleteAuthority
@Auditable(parameters={
  "name",
  "cascade"
})
void deleteAuthority(String name,
                     boolean cascade)
Delete an authority and all its relationships, optionally recursively deleting child authorities of the same type.
Parameters:
name - the authority long name
cascade - should the delete be cascaded to child authorities of the same type?

getContainedAuthorities
@Auditable(parameters={
  "type",
  "name",
  "immediate"
})
Set<StringgetContainedAuthorities(AuthorityType type,
                                    String name,
                                    boolean immediate)
Get all the authorities that are contained by the given authority. For a group you could get all the authorities it contains, just the users it contains or just the other groups it includes.
Parameters:
type - - if not null, limit to the type of authority specified
name - - the name of the containing authority
immediate - - if true, limit the depth to just immediate child, if false find authorities at any depth
Returns:
Set

getContainingAuthorities
@Auditable(parameters={
  "type",
  "name",
  "immediate"
})
Set<StringgetContainingAuthorities(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 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.
Parameters:
type - - if not null, limit to the type of authority specified
name - - the name of the authority for which the containing authorities are required.
immediate - - limit to immediate parents or any ancestor.
Returns:
Set

getContainingAuthoritiesInZone
@Auditable(parameters={
  "type",
  "name",
  "zoneName",
  "filter",
  "size"
})
Set<StringgetContainingAuthoritiesInZone(AuthorityType type,
                                           String name,
                                           String zoneName,
                                           org.alfresco.service.cmr.security.AuthorityService.AuthorityFilter filter,
                                           int size)
Get a set of authorities with varying filter criteria
Parameters:
type - authority type or null for all types
name - if non-null, only return those authorities who contain this authority
zoneName - if non-null, only include authorities in the named zone
filter - optional callback to apply further filter criteria or null
size - if greater than zero, the maximum results to return. The search strategy used is varied depending on this number.
Returns:
a set of authorities

getShortName
@Auditable(parameters="name")
String getShortName(String name)
Extract the short name of an authority from its full identifier.
Parameters:
name - String
Returns:
String

getName
@Auditable(parameters={
  "type",
  "shortName"
})
String getName(AuthorityType type,
               String shortName)
Create the full identifier for an authority given its short name and type.
Parameters:
type - AuthorityType
shortName - String
Returns:
String

authorityExists
@Auditable(parameters="name")
boolean authorityExists(String name)
Check if an authority exists.
Parameters:
name - (the long name).
Returns:
true, the authority exists.

getAuthorityDisplayName
@Auditable(parameters="name")
String getAuthorityDisplayName(String name)
Get the display name for the given authority.
Parameters:
name - - the full authority string including any prefix (e.g. GROUP_woof)
Returns:
- the display name

setAuthorityDisplayName
@Auditable(parameters={
  "authorityName",
  "authorityDisplayName"
})
void setAuthorityDisplayName(String authorityName,
                             String authorityDisplayName)
Set the display name for the given authority. Setting the display name is only supported for authorities of type group
Parameters:
authorityName - String
authorityDisplayName - String

getAuthorityNodeRef
@Auditable(parameters="name")
NodeRef getAuthorityNodeRef(String name)
Gets the authority node for the specified name
Parameters:
name - The authority name
Returns:
the reference to the authority node

getOrCreateZone
@Auditable(parameters="zoneName")
NodeRef getOrCreateZone(String zoneName)
Gets or creates an authority zone node with the specified name
Parameters:
zoneName - the zone name
Returns:
reference to the zone node

getZone
@Auditable(parameters="zoneName")
NodeRef getZone(String zoneName)
Gets an authority zone node with the specified name
Parameters:
zoneName - the zone name
Returns:
reference to the zone node or null

getAuthorityZones
@Auditable(parameters="name")
Set<StringgetAuthorityZones(String name)
Gets the name of the zone containing the specified authority.
Parameters:
name - the authority long name
Returns:
the the name of the zone containing the specified authority, ZONE_APP_DEFAULT if the authority exists but has no zone, or null if the authority does not exist.

getAllAuthoritiesInZone
@Auditable(parameters={
  "zoneName",
  "type"
})
Set<StringgetAllAuthoritiesInZone(String zoneName,
                                    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)
Parameters:
zoneName - the zone name - note: if zone does not exist then will currently return empty set
type - the authority type to filter by or null for all authority types
Returns:
the names of all authorities in a zone, optionally filtered by type
See Also:
(paged)

getAllRootAuthoritiesInZone
@Auditable(parameters={
  "zoneName",
  "type"
})
Set<StringgetAllRootAuthoritiesInZone(String zoneName,
                                        AuthorityType type)
Gets the names of all root authorities in a zone, optionally filtered by type.
Parameters:
zoneName - the zone name
type - the authority type to filter by or null for all authority types
Returns:
the names of all root authorities in a zone, optionally filtered by type

addAuthorityToZones
@Auditable(parameters={
  "authorityName",
  "zones"
})
void addAuthorityToZones(String authorityName,
                         Set<String> zones)
Add a zone to an authority.
Parameters:
authorityName - String
zones - Set

removeAuthorityFromZones
@Auditable(parameters={
  "authorityName",
  "zones"
})
void removeAuthorityFromZones(String authorityName,
                              Set<String> zones)
Remove a zone from an authority
Parameters:
authorityName - String
zones - Set

getDefaultZones
@NotAuditable
Set<StringgetDefaultZones()
Get the name of the default zone.
Returns:
the default zone

findAuthorities
@Auditable(parameters="type")
Set<StringfindAuthorities(AuthorityType type,
                            String parentAuthority,
                            boolean immediate,
                            String displayNamePattern,
                            String zoneName)
Search for authorities by pattern matching (* and ?) against the authority name. Note: This will use a search index to find the results (eg. via Lucene / SOLR).
Parameters:
type - AuthorityType
parentAuthority - if non-null, will look only for authorities who are a child of the named parent
immediate - if true then only search root groups if parentAuthority is null, or immediate children of parentAuthority if it is non-null.
displayNamePattern - String
zoneName - - may be null to indicate all zones
Returns:
Set

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2018 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.