public class People extends BaseScopableProcessorExtension implements org.springframework.beans.factory.InitializingBean
Modifier and Type | Field and Description |
---|---|
protected static String |
HINT_CQ_SUFFIX |
protected org.alfresco.repo.tenant.TenantService |
tenantService |
Constructor and Description |
---|
People() |
Modifier and Type | Method and Description |
---|---|
void |
addAuthority(ScriptNode parentGroup,
ScriptNode authority)
Add an authority (a user or group) to a group container as a new child
|
void |
afterPropertiesSet() |
void |
changePassword(String oldPassword,
String newPassword)
Change the password for the currently logged in user.
|
ScriptNode |
createGroup(ScriptNode parentGroup,
String groupName)
Create a new group with the specified unique name
|
ScriptNode |
createGroup(String groupName)
Create a new root level group with the specified unique name
|
ScriptNode |
createPerson(String userName)
Create a Person with the given user name
|
ScriptNode |
createPerson(String userName,
String firstName,
String lastName,
String emailAddress)
Create a Person with the given user name, firstName, lastName and emailAddress
|
ScriptNode |
createPerson(String userName,
String firstName,
String lastName,
String emailAddress,
String password,
boolean setAccountEnabled)
Create a Person with an optionally generated user name.
|
ScriptNode |
createPerson(String userName,
String firstName,
String lastName,
String emailAddress,
String password,
boolean setAccountEnabled,
boolean notifyByEmail)
Create a Person with an optionally generated user name
|
void |
deleteGroup(ScriptNode group)
Deletes a group from the system.
|
void |
deletePerson(String username)
Delete a Person with the given username
|
void |
disableAccount(String userName)
Disable user account.
|
void |
enableAccount(String userName)
Enable user account.
|
Map<String,Boolean> |
getCapabilities(ScriptNode person)
Gets a map of capabilities (boolean assertions) for the given person.
|
org.mozilla.javascript.Scriptable |
getContainerGroups(ScriptNode person)
Gets the groups that contain the specified authority
|
boolean |
getExcludeTenantFilter() |
ScriptNode |
getGroup(String groupName)
Gets the Group given the group name
|
ScriptableHashMap |
getImmutableProperties(String username)
Return a map of the Person properties that are marked as immutable for the given user.
|
org.mozilla.javascript.Scriptable |
getMembers(ScriptNode group)
Gets the members (people) of a group (including all sub-groups)
|
org.mozilla.javascript.Scriptable |
getMembers(ScriptNode group,
boolean recurse)
Gets the members (people) of a group
|
org.mozilla.javascript.Scriptable |
getPeople(String filter)
Deprecated.
recated see getPeople(filter, maxResults)
|
org.mozilla.javascript.Scriptable |
getPeople(String filter,
int maxResults)
Get the collection of people stored in the repository.
|
org.mozilla.javascript.Scriptable |
getPeople(String filter,
int maxResults,
String sortBy,
boolean sortAsc)
Get the collection of people stored in the repository.
|
protected List<PersonService.PersonInfo> |
getPeopleImpl(String filter,
ScriptPagingDetails pagingRequest,
String sortBy,
Boolean sortAsc) |
protected List<PersonService.PersonInfo> |
getPeopleImplDB(String filter,
ScriptPagingDetails pagingRequest,
String sortBy,
Boolean sortAsc) |
protected List<org.alfresco.service.cmr.repository.NodeRef> |
getPeopleImplSearch(String term,
String[] tokens,
ScriptPagingDetails pagingRequest,
String sortBy,
Boolean sortAsc) |
org.mozilla.javascript.Scriptable |
getPeoplePaging(String filter,
ScriptPagingDetails pagingRequest,
String sortBy,
Boolean sortAsc) |
org.alfresco.service.cmr.search.PermissionEvaluationMode |
getPermissionEvaluationMode() |
ScriptNode |
getPerson(String username)
Gets the Person given the username
|
String |
getPersonFullName(String username)
Faster helper when the script just wants to build the Full name for a person.
|
boolean |
isAccountEnabled(String userName)
Return true if the specified user account is enabled.
|
boolean |
isAdmin(ScriptNode person)
Return true if the specified user is an Administrator authority.
|
boolean |
isGuest(ScriptNode person)
Return true if the specified user is an guest authority.
|
void |
removeAuthority(ScriptNode parentGroup,
ScriptNode authority)
Remove an authority (a user or group) from a group
|
void |
setAuthenticationService(MutableAuthenticationService authenticationService)
Sets the authentication service.
|
void |
setAuthorityDAO(AuthorityDAO authorityDAO)
Set the authority DAO
|
void |
setAuthorityService(AuthorityService authorityService)
Set the authority service
|
void |
setContentUsageService(ContentUsageService contentUsageService) |
void |
setDefaultListMaxResults(int defaultListMaxResults) |
void |
setHonorHintUseCQ(boolean honorHintUseCQ)
Allows customers to choose to use Solr or Lucene rather than a canned query in
getPeople(String, int, String, boolean) when
" [hint:useCQ]" is appended to the search term (currently Share's
User Console does this). |
void |
setPassword(String userName,
String password)
Set a password for the given user.
|
void |
setPersonService(PersonService personService)
Set the person service
|
void |
setQuota(ScriptNode person,
String quota)
Set the content quota in bytes for a person.
|
void |
setServiceRegistry(ServiceRegistry serviceRegistry)
Set the service registry
|
void |
setStoreUrl(String storeRef)
Set the default store reference
|
void |
setTenantService(org.alfresco.repo.tenant.TenantService tenantService) |
void |
setUserNameGenerator(UserNameGenerator userNameGenerator)
Set the user name generator service
|
void |
setUserRegistrySynchronizer(UserRegistrySynchronizer userRegistrySynchronizer)
Set the UserRegistrySynchronizer
|
getScope, setScope
getExtensionName, register, setExtensionName, setProcessor
protected org.alfresco.repo.tenant.TenantService tenantService
protected static final String HINT_CQ_SUFFIX
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void setStoreUrl(String storeRef)
storeRef
- the default store referencepublic void setAuthenticationService(MutableAuthenticationService authenticationService)
authenticationService
- the authentication servicepublic void setServiceRegistry(ServiceRegistry serviceRegistry)
serviceRegistry
- the service registrypublic void setAuthorityDAO(AuthorityDAO authorityDAO)
authorityDAO
- authority daopublic void setAuthorityService(AuthorityService authorityService)
authorityService
- The authorityService to set.public void setPersonService(PersonService personService)
personService
- The personService to set.public void setContentUsageService(ContentUsageService contentUsageService)
contentUsageService
- the ContentUsageService to setpublic void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
tenantService
- the tenantService to setpublic void setUserNameGenerator(UserNameGenerator userNameGenerator)
userNameGenerator
- the user name generatorpublic void setUserRegistrySynchronizer(UserRegistrySynchronizer userRegistrySynchronizer)
userRegistrySynchronizer
- UserRegistrySynchronizerpublic void setDefaultListMaxResults(int defaultListMaxResults)
public void setHonorHintUseCQ(boolean honorHintUseCQ)
getPeople(String, int, String, boolean)
when
" [hint:useCQ]"
is appended to the search term (currently Share's
User Console does this). The down side is that new users may not appear as they
will not have been indexed. This is similar to what happened in 4.1.1 prior to
MNT-7548 (4.1.2 and 4.1.1.1). The down side of using a canned query at the moment
is that there is a bug, so that it is impossible to search for names such as
"Carlos Allende GarcĂa"
where the first or last names may contain spaces.
See MNT-9719 for more details. The alfresco global property
people.search.honor.hint.useCQ
is used to set this value (default is true).public void deletePerson(String username)
username
- the username of the person to deletepublic ScriptNode createPerson(String userName, String firstName, String lastName, String emailAddress, String password, boolean setAccountEnabled)
userName
- userName or null for a generated user namefirstName
- firstNamelastName
- lastNameemailAddress
- emailAddresspassword
- if not null creates a new authenticator with the given password.setAccountEnabled
- set to 'true' to create enabled user account, or 'false' to
create disabled user account for created person.public ScriptNode createPerson(String userName, String firstName, String lastName, String emailAddress, String password, boolean setAccountEnabled, boolean notifyByEmail)
userName
- userName or null for a generated user namefirstName
- firstNamelastName
- lastNameemailAddress
- emailAddresspassword
- if not null creates a new authenticator with the given password.setAccountEnabled
- set to 'true' to create enabled user account, or 'false' to
create disabled user account for created person.notifyByEmail
- set to 'true' to have the new user emailed to let them know
their account details. Only applies if a username and
password were supplied.public void enableAccount(String userName)
userName
- user name for which to enable user accountpublic void disableAccount(String userName)
userName
- user name for which to disable user accountpublic boolean isAccountEnabled(String userName)
userName
- user name to test accountpublic void changePassword(String oldPassword, String newPassword)
oldPassword
- Old user passwordnewPassword
- New user passwordpublic void setPassword(String userName, String password)
userName
- Username to change password forpassword
- Password to setpublic ScriptNode createPerson(String userName)
userName
- the user name of the person to createpublic ScriptNode createPerson(String userName, String firstName, String lastName, String emailAddress)
userName
- the user name of the person to createpublic void setQuota(ScriptNode person, String quota)
person
- Person to set quota against.quota
- As a string, in bytes, a value of "-1" means no quota is setpublic org.mozilla.javascript.Scriptable getPeople(String filter)
filter
- filter query string by which to filter the collection of people.
If nullthen all people stored in the repository are returned
public org.mozilla.javascript.Scriptable getPeople(String filter, int maxResults)
filter
- filter query string by which to filter the collection of people.
If nullthen all people stored in the repository are returned
maxResults
- maximum results to return or all if <= 0public org.mozilla.javascript.Scriptable getPeople(String filter, int maxResults, String sortBy, boolean sortAsc)
filter
- filter query string by which to filter the collection of people.
If nullthen all people stored in the repository are returned
maxResults
- maximum results to return or all if <= 0sortBy
- field for sortingsortAsc
- sort ascending or notpublic org.mozilla.javascript.Scriptable getPeoplePaging(String filter, ScriptPagingDetails pagingRequest, String sortBy, Boolean sortAsc)
protected List<PersonService.PersonInfo> getPeopleImpl(String filter, ScriptPagingDetails pagingRequest, String sortBy, Boolean sortAsc)
protected List<PersonService.PersonInfo> getPeopleImplDB(String filter, ScriptPagingDetails pagingRequest, String sortBy, Boolean sortAsc)
protected List<org.alfresco.service.cmr.repository.NodeRef> getPeopleImplSearch(String term, String[] tokens, ScriptPagingDetails pagingRequest, String sortBy, Boolean sortAsc) throws Throwable
Throwable
public ScriptNode getPerson(String username)
username
- the username of the person to getpublic String getPersonFullName(String username)
username
- the username of the person to get Full name forpublic ScriptNode getGroup(String groupName)
groupName
- name of group to getpublic void deleteGroup(ScriptNode group)
group
- The group to deletepublic ScriptNode createGroup(String groupName)
groupName
- The unique group name to create - NOTE: do not prefix with "GROUP_"public ScriptNode createGroup(ScriptNode parentGroup, String groupName)
parentGroup
- The parent group node - can be null for a root level groupgroupName
- The unique group name to create - NOTE: do not prefix with "GROUP_"public void addAuthority(ScriptNode parentGroup, ScriptNode authority)
parentGroup
- The parent container groupauthority
- The authority (user or group) to addpublic void removeAuthority(ScriptNode parentGroup, ScriptNode authority)
parentGroup
- The parent container groupauthority
- The authority (user or group) to removepublic org.mozilla.javascript.Scriptable getMembers(ScriptNode group)
group
- the group to retrieve members forpublic org.mozilla.javascript.Scriptable getMembers(ScriptNode group, boolean recurse)
group
- the group to retrieve members forrecurse
- recurse into sub-groupspublic org.mozilla.javascript.Scriptable getContainerGroups(ScriptNode person)
person
- the user (cm:person) to get the containing groups forpublic boolean isAdmin(ScriptNode person)
person
- to testpublic boolean isGuest(ScriptNode person)
person
- to testpublic Map<String,Boolean> getCapabilities(ScriptNode person)
person
- the personpublic ScriptableHashMap getImmutableProperties(String username)
username
- Stringpublic boolean getExcludeTenantFilter()
public org.alfresco.service.cmr.search.PermissionEvaluationMode getPermissionEvaluationMode()
Copyright © 2005–2017 Alfresco Software. All rights reserved.