Last active
March 19, 2017 19:27
-
-
Save hishaamn/712885ac9df21eebb8f5daeacf2a6d5f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EnforceEntireTree | |
{ | |
public void Process(LoggedInArgs args) | |
{ | |
User user = User.FromName(args.Username, true); | |
Assert.IsNotNull(user, "user"); | |
string key = "/" + user.Name + "/UserOptions.View.ShowEntireTree"; | |
user.Profile.Initialize(user.Name, true); | |
user.Profile[key] = "true"; | |
user.Profile.Save(); | |
// Get the shell site here | |
var site = Sitecore.Sites.SiteContext.GetSite("shell"); | |
RegistryCache registryCache = CacheManager.GetRegistryCache(site ); | |
registryCache.Clear(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment