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.
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.
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
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 pathyou can get this value in a view from
Model.Content.Path
(orModel.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.Thank you, I will have a look and see if this shouldnt do the trick
is working on a reply...