11-17-2016 09:18 AM
Hello,
Is there any way of getting the list of all UserGroups and SubUserGroups of a Site?
Currently I see only method listMembers() which returns only the list of Users, not the groups.
Thank you in advance.
11-19-2016 10:10 AM
When you want to get all the users and/or groups within sites you may also always use the AuthorityService API to list them. The SiteService API only provides the convenience operations that are needed e.g. to provide site management functionality in the UI. SiteService.getSiteGroup(shortName) gets you the Alfresco group that contains all the roles of the site, and transitively all the groups / users. You can use that in conjunction with AuthorityService.getContainedAuthorities(authorityType, name, immediate) to retrieve members.
11-21-2016 07:53 AM
In general I want to retrieve all Site's USERs or User_GROUPS.
for Example:
shortName of site - "example-site":
user: 'admin' - SiteManager
group: 'Test_group' (which includes -> users: 'abc', 'xyz' + subgroup: 'test_subGroup'(user: 'some') - SiteConsumer
So at the end I want to have in Collection:
<admin(user), SiteManager>
<Test_group(group), SiteConsumer>
and somehow if the authority is a Group to get all data (subgroups and users) until the last user.
so currently the method -> Map<String, String> listMembers = this.siteService.listMembers(shortName, null, null, 0, false); is OK.
but I want to get the data as an object not as string,
so first, if it is an user, I have to get all data for the user as an object
and second, if it is a group to get the initial group object 1st and also all list of subgroups and/or users
and return every Group as an object(with user list including) and after that the data for the users as an object.
I checked PersonService ,but it provides too basic information for an user.
I would be glad if you assist me with the methods which I should use and also the services.
Thank you in advance.
11-21-2016 08:49 AM
If the result of that listMembers is okay for your case but you have this kind of specific enrichment / object requirements, then I am afraid you have to do all of this aggregation yourself with custom code. The SiteService, AuthorityService, PersonService and NodeService are all you will need (NodeService is to get more extensive information about a person than available from PersonService via getProperties(personNodeRef)).
11-23-2016 04:04 AM
I looped all groups/subgroups and users with the authorityService.getContainedAuthorities(null, name, true) method.
And managed to get all NodRefs of the objects and I used getProperties method as you said, however I want to get all information for exmaple for an User but I see only this information:
{
"{http://www.alfresco.org/model/content/1.0}email": "admin@alfresco.com",
"{http://www.alfresco.org/model/content/1.0}homeFolder": {
"storeRef": {
"protocol": "workspace",
"identifier": "SpacesStore"
},
"id": "b2e97ee9-1154-411e-b9b7-a7d105049b0a"
},
"{http://www.alfresco.org/model/system/1.0}cascadeTx": 38,
"{http://www.alfresco.org/model/content/1.0}lastName": "",
"{http://www.alfresco.org/model/content/1.0}organizationId": "",
"{http://www.alfresco.org/model/system/1.0}node-uuid": "e8d408b8-1e7b-41c2-8722-0f7327df6919",
"{http://www.alfresco.org/model/content/1.0}name": "e8d408b8-1e7b-41c2-8722-0f7327df6919",
"{http://www.alfresco.org/model/content/1.0}sizeCurrent": 0,
"{http://www.alfresco.org/model/system/1.0}store-protocol": "workspace",
"{http://www.alfresco.org/model/system/1.0}store-identifier": "SpacesStore",
"{http://www.alfresco.org/model/system/1.0}node-dbid": 32,
"{http://www.alfresco.org/model/system/1.0}locale": "en_US",
"{http://www.alfresco.org/model/content/1.0}userName": "admin",
"{http://www.alfresco.org/model/content/1.0}homeFolderProvider": "bootstrapHomeFolderProvider",
"{http://www.alfresco.org/model/content/1.0}owner": "admin",
"{http://www.alfresco.org/model/system/1.0}cascadeCRC": 3567086879,
"{http://www.alfresco.org/model/content/1.0}firstName": "Administrator"
},
For example I don't see the password property and user role.
Basically, if I want to collect all the properties and use them to create a person in another alfresco system, the necessary information is in http://www.alfresco.org/model/content/1.0 , right ?
Could you please tell me how to retrieve the full package of properties of an user?
Could you please also tell what exactly the property "{http://www.alfresco.org/model/content/1.0}name": "e8d408b8-1e7b-41c2-8722-0f7327df6919", is ?
Thank you in advance.
11-23-2016 04:36 AM
You will never be able to access the user password for security reasons. Also, there is no such thing as a user role - the "role" is always implicit and derived from all the groups the user is a member of. What you get with getProperties is EVERYTHING you will ever be able to get for that user.
You can get the derived role of a user for a specific site by calling the SiteService.getMembersRole(shortName, authorityName) operation.
Almost every node in the Alfresco repository is requried to have a "name" property. For some types of nodes (person nodes) there is not necessarily a single, unique value that can be used for a name (or there are multiple constituent values with their own properties), so a generated UUID is used by default.
11-23-2016 06:18 AM
Yes, but in order to make a copy of the same user I will need not only the role in the site but all its "roles":
I managed to get the data from authorityService.getAuthoritiesForUser("admin")
GROUP_ALFRESCO_ADMINISTRATORS
GROUP_ALFRESCO_MODEL_ADMINISTRATORS
GROUP_ALFRESCO_SEARCH_ADMINISTRATORS
GROUP_EMAIL_CONTRIBUTORS
GROUP_EVERYONE
GROUP_SITE_ADMINISTRATORS
GROUP_site_swsdp
GROUP_site_swsdp_SiteManager
ROLE_ADMINISTRATOR
But I will need the hierarchy, so if I start with "admin" I want to get the authority above it and so on... until the root.
11-25-2016 03:22 AM
When I want to check the subAuthorities of the ROLE_ADMINISTRATOR or GROUP_EVERYONE:
this.authorityService.getContainedAuthorities(null, "ROLE_ADMINISTRATOR" , true)
I receive the following exception which contradicts to the above:
org.springframework.extensions.webscripts.WebScriptException: 10240016 Wrapped Exception (with status template):
10240003 An authority was not found for ROLE_ADMINISTRATOR
10240005 An authority was not found for GROUP_EVERYONE
Do you any idea why I couldn't find all authorities assigned to a ROLE_ADMINISTRATOR or a GROUP_EVERYONE?
11-25-2016 05:38 AM
ROLE_ADMINISTRATOR and GROUP_EVERYONE are "virtual" - they do not exist as actual data. Anything with the prefix "ROLE_" is always "virtual" and "membership" in GROUP_EVERYONE is always a given for any user. User that are member of GROUP_ALFRESCO_ADMINISTRATORS or otherwise set as administrator (e.g. via ldap.authentication.defaultAdministratorUserNames) have ROLE_ADMINISTRATOR.
Querying GROUP_EVERYONE is the same as listing ALL users.
Querying ROLE_ADMINISTRATOR is not possible in just one operation since many components (module authentication systems) may contribute to that role without persistent data to be queried.
12-07-2016 04:38 AM
hi af, while creating user it self can possible to assign into any site. if possible how and piece of code
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.