User rights in sitemap permissions in asp.net web forms

Viewed 116

I have old complex project which includes user roles. In file Rights.sitemap I have code like this:

<Page url="~/Account/Account.aspx" rightsAny="OwnPesonalDetailesView, OwnPasswordChange" />
<Page url="~/Account/PersonalData/PersonalData.aspx" rightsAny="OwnPersonalDataChange, OwnPersonalDataChange" />
<Page url="~/Account/PasswordChange/PasswordChange.aspx" rightsAny="OwnPasswordChange" />
<Page url="~/Account/LoginHistory/LoginHistory.aspx" />

I am trying to understand what 'rightsAny' tag means in this context. I tried to google it but without success. When I crtl+F and search for 'rightsAny' it only occurs in this .sitemap file.

Values after tag 'rightsAny' refer to RightNameValues.cs which code sample is below:

public const string OwnPasswordChange = "OwnPasswordChange";
public const string OwnPersonalDataChange = "OwnPersonalDataChange";
public const string OwnPesonalDetailesView = "OwnPesonalDetailesView";
public const string PartnersActivate = "PartnersActivate";

I can use this right in context like below:

if(Foo.Common.Application.AppContext.Current.Operator.HasRight(RightNameValues.OwnPasswordChange))
    {
        Label2.Text = "This user have rights to change password";
    }

But I tried all combination of setting line ex:

<Page url="~/Account/PasswordChange/PasswordChange.aspx" 
 rightsAny="OwnPasswordChange" />

and I do not see any changes on site PasswordChange.aspx. Maybe some of you know anything about my problem?

1 Answers

Most probably, the project implements a custom site map provider, which inherits from the SiteMapProvider class.

You may want to find the class of the custom provider (look inside the App_Code folder or the web.config for any added site map providers) and take a look at the overridden methods to discover the way your proprietary formatted .sitemap file is parsed.

This way you'll be able to understand the meaning of the rightsAny property.

Related