cancel
Showing results for 
Search instead for 
Did you mean: 

Hos to get full list of users & their belonging groups ?

msevestre
Champ in-the-making
Champ in-the-making
Hello

I'm trying to generate a file with a JS script to help me to administrate users & group: I'd like to obtain a list with full clear test of user names & groups which they are attaached to ?

I tried to create a Javascript script that is nearly working, but I am not able to display "readable" user names & groups.

Here is the current source code:

var gens = people.getPeople(null);

var logFile = space.childByNamePath("log_users.txt");
if (logFile == null) {
   logFile = space.createFile("log_users.txt");
}
logFile.content = "";

for (var i=0; i<gens.length;i++) {
  logFile.content += gens[i]+"\n";

  var groupes= people.getContainerGroups(utils.getNodeFromString(gens[i]));

  for (var j=0; j<groupes.length;j++) {
    logFile.content += "\t"+groupes[j].name+"\n";
  }

}

I currently have an output of this kind :

workspace://SpacesStore/71a950d8-f26b-40ee-a496-51133147c345
   GROUP_ALFRESCO_ADMINISTRATORS
   d60ba031-128f-408e-aaa4-de69ce7ddd95
   e7252aad-8ef9-4986-90bd-7664e86384ab
workspace://SpacesStore/a0f6862c-ebb3-432f-b36e-4ba7076a2dc2
workspace://SpacesStore/8cb10f0a-eb91-4e12-96c8-c9321c6d8a08
workspace://SpacesStore/b019d0ee-c45d-44ea-b750-e0aeedf85abb
   GROUP_ALFRESCO_ADMINISTRATORS
   d60ba031-128f-408e-aaa4-de69ce7ddd95
   e7252aad-8ef9-4986-90bd-7664e86384ab

as you can see, user names have a "workspace://" type (using .name property give me "undefined" for all users). Groups are with a reference, except for basic groups (GROUP_ALFRESCO_ADMINISTRATORS, EMAIL, etc.) that are displayed clearly.

Note: if any other script exists, no problem to froget mine to use another one Smiley Happy

Thanks for any help
Matt
17 REPLIES 17

msevestre
Champ in-the-making
Champ in-the-making
Hi !

Perfect, it works !

Note: me groups were created through the web interface and some other through javascripts scripts.

Thansk for your help !

Matt

jayjayecl
Confirmed Champ
Confirmed Champ
No problem, glad this helped

chandu7ee
Champ in-the-making
Champ in-the-making
hey thanks its worked fine..

but here i need to display the tenant names and users under these tenats..

is there any way to do this.

i did not found any tenants API in alfresco wiki.


thanks & regards
Chandu

jenn_l
Champ on-the-rise
Champ on-the-rise
Hi all,

I have an Alfresco 3.2r enterprise and Community 3.2r environment. The code above worked for Alfresco 3.0 and Alfresco 3.1.
In 3.2 I get null instead of all the defined groupnames with GROUP_ as a prefix.
Is there someone out there who can help me with retrieving the same as above mentioned in Alfresco 3.2?

Thanks,
Regards,
Jenny

kyriakos
Champ in-the-making
Champ in-the-making
sorry i want to do the same thing on community edition 3.2r
and also i wanted to know where the results are announced…
because i made a script and i called it but i get this warn

13:50:48,462 WARN  [org.alfresco.repo.cache.TransactionalCache.org.alfresco.userToAuthorityTransactionalCache] Transactional update cache 'org.alfresco.userToAuthorityTransactionalCache' is full (100).

majicj
Champ in-the-making
Champ in-the-making
sorry i want to do the same thing on community edition 3.2r
and also i wanted to know where the results are announced…
because i made a script and i called it but i get this warn

13:50:48,462 WARN  [org.alfresco.repo.cache.TransactionalCache.org.alfresco.userToAuthorityTransactionalCache] Transactional update cache 'org.alfresco.userToAuthorityTransactionalCache' is full (100).

I Encountered this error when running Alfresco in Windows.  To fix this I had to edit my cache settings in tomcat\webapps\alfresco\WEB-INF\classes\alfresco\cache-context.xml file. I suggest making a backup copy of this file before editing in case you mess something up.  I just increased the value (in your case try setting userToAuthorityTransactionalCache to 200 or 400 etc .) until the error went away.

kyriakos
Champ in-the-making
Champ in-the-making
thank you man Smiley Wink

ilazki
Champ in-the-making
Champ in-the-making
To get the groups in the community edition (I'm using 3.2 r2)  use cm:authorityDisplayName to get the group name without the GROUP_ prefix.
You can check the contentModel.

Hope it's usefull