Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • F 19 posts 39 karma points
    Sep 05, 2011 @ 08:29
    F
    0

    How to refresh permissions programatically

    Hello,

    I came up with the following code to modify permissions for a user on a node :

    User u = User.GetCurrent();
    string s = u.GetPermissions(Node.GetCurrent().Path);
    if (u != null)
    {
        Document document = new Document(Node.GetCurrent().Id);
        Permission.UpdateCruds(u, (umbraco.cms.businesslogic.CMSNode)document, ":FCH");
        u.resetNotificationCache();
        u.Save();
    }
    
    It works as intended, except for the timing.
    Apparently, it takes some time (less than a minute) for Umbraco to show the new permissions after this code run.
    I thought using "Save()", or "resetNotificationCache()" would help but there is still a delay.
    Is there a way to force umbraco to refresh its permissions?
    Thank you,
    F

Please Sign in or register to post replies

Write your reply to:

Draft