November Happy Hour will be moved to Thursday December 5th.

A/B Testing - for selected users only

Vote:
 

Is it possible to limit the access to the EpiServer A/B testing tool to specific user groups?

#187624
Jan 30, 2018 8:56
Vote:
 

Hi Tomas,

Only CMS users that have publish permissions on the content have the option to create and manage A\B tests for items in the CMS. The thinking being that the B version of the content, which is in a draft state during the A\B test, will be live on the site so the user that creates the test for that content should be trusted to publish to the site (not to mention picking a winner will publish that version of the content).

#190899
Apr 18, 2018 14:51
Vote:
 

I think it would be nice to be able to hide that functionality, so that only specific roles can set up / monitor see AB tests that are running. I get the thinking on Publish rights, but with our clients, it is only the more advanced digital marketers who would be using the AB test functionality 

#190902
Apr 18, 2018 15:58
Vote:
 

That is a good point, I will write up the enhancement to include an A\B testing user group into the package for this type of use case. Thanks for the input!

#190904
Apr 18, 2018 16:08
Vote:
 

Our team came up with a solution to this. Added this to BaseController, to set a value on the profile indicating if AB-testing should be available.

        protected override IActionInvoker CreateActionInvoker()
        {
            RestrictedUserCheck();
            ...
        }    

    private void RestrictedUserCheck()
        {
            if(System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
            {
                const string restrictedUserKey = "no_ab_testing_for_you_mister";
                var profileRepo = ServiceLocator.Current.GetInstance<IProfileRepository>();
                var profile = profileRepo.GetOrCreateProfile(System.Web.HttpContext.Current.User.Identity.Name);

                // We only need this code to run once
                object profileValue;
                if (!profile.Settings.TryGetValue(restrictedUserKey, out profileValue))
                {
                    profile.Settings[restrictedUserKey] = !System.Web.HttpContext.Current.User.IsInRole("MarketingAdmins");
                    // Saving to the profile allows us to access this value in the client side UI
                    profileRepo.Save(profile);
                }
            }
        }

And then some hacky dojo magic, to update the UI based on the profile:

define([
// Dojo
    "dojo",
    "dojo/_base/declare",
//CMS
    "epi/_Module",
    "epi/dependency",
    "epi/routes",
    "dojo/when"
], function (
// Dojo
    dojo,
    declare,
//CMS
    _Module,
    dependency,
    routes,
    when,
    StoreInitializer
) {

    return declare("app.Initializer", [_Module], {
        // summary: Module initializer for the default module.

        initialize: function () {

            this.inherited(arguments);

            var profile = dependency.resolve("epi.shell.Profile");

            if (profile) {

                // Profile returns a promise so we wait for this before checking the value
                when(profile.get("no_ab_testing_for_you_mister"), function (restricteduser) {
                    if (restricteduser === true) {
                        // Get the global command registry
                        var registry = dependency.resolve('epi.globalcommandregistry');
                        registry._mappings['epi.cms.publishmenu'].providers.splice(2, 1);
                    }
                });
            }

            

            var storeInitializer = new StoreInitializer();
            storeInitializer.initialize();
        }
    });
});

And then register the javascript file in module.config

  <clientModule initializer="<path_to_the_javascript_file>
    <requiredResources>
      <add name="vendors-jquery" />
    </requiredResources>
    <moduleDependencies>
      <add dependency="CMS" type="RunAfter" />
    </moduleDependencies>
  </clientModule

The A/B-testing option is hidden from the publish menu, if the user is not added to the group MarketingAdmin.

#191166
Edited, Apr 23, 2018 9:49
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.