Getting a list of the Default User Groups using the Tridion Core Service

byJonathan Williams

December 28th 2017

1 Minute Read

As you (probably) already know, Tridion comes out of the box with a number of Default User Groups:

Author

Editor

Chief Editor

Publication Manager

Etc.

When a new Publication is created in Tridion
predefined Rights are automatically granted to these Groups on the Publication.

Whilst this can be really useful when creating a large number of new Publications, and it's normally considered
best practice for all new Groups to be a member of one (or more) of these Default Groups (with controlled Scope), sometimes it's undesirable.

I recently helped a client to clean up their Tridion Security Model and make their implementation consistent across the different branches in their BluePrint. Part of that task involved removing the Rights of these Default Groups from
a large number of Publications (across the DTAP environments).

Given the scale of the task, I opted to do this using a Tridion Core Service script, rather than manually through the Content Management Explorer (CME) interface ⟵ which would've been a definite ‘headphones on’ job!

Initially, I tried to get the list of Default Groups by setting the
IsPredefined property to
true on the GroupsFilterData object:

However, it seems that this only returns the 'Administrators' and 'Everyone' Groups, and not the Default Groups (Author, Editor, etc.), as anticipated.

After a little digging, I discovered that the way to identify the Default Groups is through the
GroupData.DefaultGroupId property. The non-Default Groups (I.e. The client-specific ones) all have a value of 0 for property, whereas the Default Groups all have an defaultGroupId greater than 0.

Here's the code snippet that I used to get the list of Default Groups (simplified sligtly for readability):