0

What is the reason behind not co-locating serialized items and roles within the same folder? I keep my serializations in the project git repository for DTAP CI/CD purposes and with the default set-up of Unicorn all role serializations will instead be going to C:\inetpub\wwwroot\MySitecoreInstance\App_Data\serialization\security\sitecore\Roles. Is there a specific reason for this?

<!-- Note: do not co-locate serialized items and serialized roles in the same folder -->

<!--
    Unicorn.Roles.config

    Configures Unicorn to be capable of syncing security roles as well as Sitecore items.
    See Unicorn.Configs.Default.Roles.config.example for details of how to include roles and how they sync.

    This file should be present on all environments where Unicorn will be expected to sync roles.
    Normally this would be development and Content Editing (CE) environments.
    It should not hurt anything if left in a CD environment, but it may be removed.

    http://github.com/kamsar/Unicorn
-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
    <sitecore role:require="Standalone or ContentManagement">
        <unicorn>
            <defaults>
                <!-- Note: do not colocate serialized items and serialized roles in the same folder -->
                <roleDataStore physicalRootPath="$(dataFolder)\Unicorn\Unicorn.Roles\$(configurationName)" type="Unicorn.Roles.Data.FilesystemRoleDataStore, Unicorn.Roles" singleInstance="true"/>
                <roleLoader type="Unicorn.Roles.Loader.RoleLoader, Unicorn.Roles" singleInstance="true" />
                    <roleLoaderLogger type="Unicorn.Roles.Loader.DefaultRoleLoaderLogger, Unicorn.Roles" singleInstance="true" />

                <roleSerializationFormatter type="Unicorn.Roles.Formatting.YamlRoleSerializationFormatter, Unicorn.Roles" singleInstance="true" />

                <!-- 
                    If you set RemoveOrphans to true, role syncing will delete matching roles that are not serialized, like item syncing does.
                    If set to false, roles are only ever added or updated (similar to New Items Only item syncing but updates are also synced)
                -->
                <roleSyncConfiguration removeOrphans="true" type="Unicorn.Roles.Loader.DefaultRoleSyncConfiguration, Unicorn.Roles" singleInstance="true" />
            </defaults>
        </unicorn>

        <pipelines>
            <unicornSyncComplete>
                <processor type="Unicorn.Roles.Pipelines.UnicornSyncComplete.SyncRoles, Unicorn.Roles" />
            </unicornSyncComplete>
            <unicornReserializeComplete>
                <processor type="Unicorn.Roles.Pipelines.UnicornReserializeComplete.ReserializeRoles, Unicorn.Roles" />
            </unicornReserializeComplete>
        </pipelines>
    </sitecore>
</configuration>
2

You can choose any folder. Just not one that is being used for anything else.

The reason being; the Unicorn default datastore expects YML files of Items. Roles and Users are not items - the two stores are not compatible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.