AnsweredAssumed Answered

How to get the user role in a site

Question asked by svetlingulev on Aug 18, 2014
Latest reply on Aug 19, 2014 by svetlingulev
hi
I have this webscript that takes the users data, but i can't get the user role("Conributor","Collaborator" ect.) in a site.
Here is my script

<javascript>
var gens = search.luceneSearch("TYPE:\"{http://www.alfresco.org/model/content/1.0}person\"");
var a = [];
 
for (var i=0; i<gens.length;i++) {
var username = gens.properties["cm:userName"];
var firstname = gens.properties["cm:firstName"];
var lastname = gens.properties["cm:lastName"];
var umail = gens.properties["cm:email"];

var b = [];
var o = [];
var groups = people.getContainerGroups(gens);
for(var j=0; j<groups.length; j++) {
  b.push(""+ groups[j].properties['authorityName']+"");
  o.push(""+ groups[j].properties['authorityType']+"");
}

var sites = siteService.listUserSites(username);
var g=[]
for(var j=0; j<sites.length; j++) {
      g.push( ""+ sites[j]['shortName']+"");
/* o.push(""+ sites[j]['cm:authorityType']+""); */
}

a.push({
   'username' : username,
        'firstname' : firstname,
        'lastname' : lastname,
        'mail' : umail,
   'groups' : b.join(';'),
   'sites' : g.join(';'),
        'athority' : o.join(';')
})
}

model.test = a;

</javascript>

Any help will be appreciated.
Thanks

Outcomes