A note about synching roles in Hedgehog TDS

23 October 2015

Problem

I recently started using the new roles synchronisation feature of Hedgehog TDS in my project, and was surprised when I found that while my roles got installed onto other environments, the settings applied to those roles did not get applied.

Investigation

I noticed this issue after making an update to one of my roles and finding that no changes showed up in the TDS roles sync window. This seemed suspicious, so knowing that TDS uses Sitecore's built-in serialization mechanism I decided to serialize that role myself which revealed the following:

Standard Editor.role

----role----
name: sitecore\Standard Editor

----role-in-role----
rolename: sitecore\Power User

----role-in-role----
rolename: sitecore\Admin User

In the sample above we see that this role is referenced by two other roles (sitecore\Power User and sitecore\Admin User), but does not include the information about the Sitecore built-in roles that it inherits from.

After seeing this, I did the same for each of the Sitecore roles which I had added to my "Standard Editor" role, and sure enough, each of those roles contained a reference to my role. Here is the contents of the "sitecore\Sitecore Client Publishing" role:

Sitecore Client Publishing.role

----role----
name: sitecore\Sitecore Client Publishing

----role-in-role----
rolename: sitecore\Sitecore Client Advanced Publishing

----role-in-role----
rolename: sitecore\Standard Editor

Solution

The obvious solution to this problem is to ensure that you include all the referenced Sitecore roles in addition to the roles you have created. For convenience, you could just follow the rule of including all roles in the TDS project. This is in contrast to the recommendation for other items and templates where you would generally avoid adding Sitecore-related things such as /sitecore/templates/System.

Notes

How to Serialize and View Roles in Sitecore

  1. Open the Sitecore Desktop.
  2. Start > Security Tools > Role Manager.
  3. In the Role Manager, click "Serialize All Roles" or select a role and click "Serialize Role".
  4. Browse to the directory where your Sitecore instance is installed then drill down to \Data\serialization\security\sitecore\Roles.
  5. You will find your serialized roles here. They are just text files so can be viewed with Notepad.

Installing roles via packages

After a brief test, I confirmed that when creating a package (from Sitecore Desktop, Start > Development Tools > Package Designer) the roles do include the referenced roles. When packaging, the roles are serialized using a different (XML) format.

Tags: Hedgehog TDS
comments powered by Disqus