Copied to clipboard

Flag this post as spam?

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


  • Kenneth Jakobsen 67 posts 203 karma points hq
    Sep 25, 2017 @ 09:42
    Kenneth Jakobsen
    0

    Is Members.MemberHasAccess behavior expected?

    Hi Guys

    I'm facing an issue with Members.MemberHasAccess("/home"); When a member is logged in it returns true regardless of which group the member belongs to.

    I.e. If member a is in group a and page a is restricted to group a then Members.MemberHasAccess("/pagea") returns true but it also returns true if member b who is a mamber of group b is logged in.

    I have verified thru the UI that only group a is allowed to view page a and member b is not allowed to view the page so there are no apparent security issues which led me to ask this question, as it may be expected behavior, but I just can see the logic behind it.

    Kenneth

  • Kevin Jump 2343 posts 14890 karma points MVP 8x c-trib
    Sep 25, 2017 @ 10:01
    Kevin Jump
    100

    Hi

    it's not really clear by the documentation but path isn't the path to the page (so it's not /home) . but its the Path value stored in the content, which is a list of ids, that make up the path

    you can get this value in a view from Model.Content.Path (or Model.Path - depends a bit on if you are in a view or partial).

    this value will more likely look like 1045,1932,2913 or something like that (that would be an example of a page three deep on your site).

    if you are doing this for navigation - then again as you go through each item on your navigation you would pass it's .Path value into the MemberHasAccess function.

  • Kenneth Jakobsen 67 posts 203 karma points hq
    Sep 25, 2017 @ 10:11
    Kenneth Jakobsen
    0

    Thank you, I will have a look and see if this shouldnt do the trick

Please Sign in or register to post replies

Write your reply to:

Draft