Alfresco Sub-groups

My goal: add a group as a sub-group of another group – ie. nest groups.

Alfresco Version: Enterprise – v3.4.7 (572)

My first try – the Alfresco Explorer UI

The problem with this is that although it will show you sub-groups it will only let you add users to groups, not other groups.

My second try – the Alfresco Share UI

I started by searching for my parent group by name.
Found it – great. Next I clicked the Edit icon.
Turns out this only lets you edit the display name of the group.
So I clicked the Browse button.
In the browse interface when you click on a group you can add sub-groups and users – perfect.
BUT…for some reason my parent group did not show up on the list. It’s not a system list or anything special, just a local Alfresco group I created.

My third try – script it

I took a look at my trusty Alfresco javascript API (http://wiki.alfresco.com/wiki/3.4_JavaScript_API)
Adding a sub-group this way is pretty simple:

  1. Find the parent group
  2. Find the child group
  3. Add the child to the parent

Here is the javascript (NOTE the “GROUP_” prefix when finding a group):

var parentGrp = people.getGroup("GROUP_My Parent Group"); 
var childGrp = people.getGroup("GROUP_My Child Group"); 
people.addAuthority(parentGrp, childGrp);

 

I don’t really understand why, in Share, searching for a specific group and browsing groups offer different options on the results.

But scripting it is a quick, easy work-around.

This entry was posted in Alfresco, ECM by tim.frith. Bookmark the permalink.
tim.frith

About tim.frith

Alfresco Certified Engineer

Senior ECM Consultant
Tim holds a diploma in Computer Systems Technology from Camosun College as well as a Bachelor of Commerce Degree with a Finance specialization from the University of Alberta. He has over 10 years of experience developing web applications with Java as well as extensive database development experience with Oracle, IBM DB2, MS SQL Server, and MySQL.

In recent years he has focused on Enterprise Content Management, with specific training and experience in Alfresco's content management suite.

And finally, Tim is a strong believer that the Edmonton Oilers will soon reclaim their rightful place at the top of the hockey world. Yes, Stanley will once again come to town.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>