Copied to clipboard

Flag this post as spam?

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


  • Jim 18 posts 36 karma points
    Jan 26, 2011 @ 12:17
    Jim
    0

    Umbraco Node Permission from Code Behind

    Hi All;

     

    I have searched for hours and not found the answer to this, so was hoping someone here could help.

    How do I get the roles set on a node from code behind?

     

    I have my node: Node nodeToCheck = new Node(nodeID);

    How do I now know what role permissions are set on this node?

     

    Thanks in advance.

     

  • Jim 18 posts 36 karma points
    Jan 26, 2011 @ 14:36
    Jim
    0

    I am using aspnet membership if it makes any difference?!

  • Jim 18 posts 36 karma points
    Jan 26, 2011 @ 14:56
    Jim
    0

    I just found out how to do this, so thought I would report back here:

     

    string[] roles = Access.GetAccessingMembershipRoles(int.Parse(nodeID), nodeToCheck.Path);

    or simpler if you do not want to manually check the roles assigned you can check against the membershipuser

     

    bool hasAccess = Access.HasAccess(int.Parse(nodeID), nodeToCheck.Path, MembershipHelper.GetCurrentUser());
  • Byron Delgado 47 posts 70 karma points
    Mar 11, 2011 @ 14:19
    Byron Delgado
    0

    Did you use Umbraco 4.6.1? as in mine is always returning null.

Please Sign in or register to post replies

Write your reply to:

Draft