in

dashCommerce

An ASP.NET Open Source e-Commerce Application

Issues with user roles on admin.sitemap

Last post 05-24-2009 6:48 PM by Designbyonyx. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-29-2008 1:27 PM

    Issues with user roles on admin.sitemap

     I have added a "Super Admin" role, and am trying to limit some of the features to which my client has access (ex. he does not need to be able to configure payment providers... he should call me instead).  However, using the "roles" attribute of the siteMapNode in admin.sitemap has no affect on what is displayed in the admin section of the site.  Has anybody tried this with success?

     ~Ryan

    Filed under: , ,
  • 05-24-2009 6:48 PM In reply to

    Re: Issues with user roles on admin.sitemap

    I am revisiting this issue, and am not having any luck.  Any help would be GREATLY appreciated.  This is what I have done so far:

    1) Added a new role "Super Admin" using the site admin interface
    2) Enabled sucurityTrimming in the root web.config:

    <siteMap enabled="true" defaultProvider="AdminXmlSiteMapProvider">
                <providers>
                    <clear/>
                    <add name="AdminXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/admin/admin.sitemap" securityTrimmingEnabled="true"/>
                    ....
                </providers>
    </siteMap>

    3) Added "roles" attribute to each node in the admin.sitemap file:

    <?xml version="1.0" encoding="utf-8" ?>
    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" enableLocalization="true">
      <siteMapNode url="~/admin/default.aspx" roles="*" title="$Resources:adminNav, Default">
        <siteMapNode url="~/admin/overview.aspx?view=si" roles="Administrator, Super Admin" title="$Resources:adminNav, Site"  >
          <siteMapNode url="~/admin/sitesettings.aspx" roles="Super Admin" title="$Resources:adminNav, SiteSettings" />
          <siteMapNode url="~/admin/rewriteurls.aspx" roles="Administrator, Super Admin" title="$Resources:adminNav, RewriteUrl" />
          <siteMapNode url="~/admin/contentedit.aspx" roles="Administrator, Super Admin" title="$Resources:adminNav, ContentManagement" />
          <siteMapNode url="~/admin/overview.aspx?view=sec" roles="Administrator, Super Admin" title="$Resources:adminNav, Security">
            <siteMapNode url="~/admin/userlist.aspx" roles="Administrator, Super Admin" title="$Resources:adminNav, UserAdministration"/>
            <siteMapNode url="~/admin/rolelist.aspx" roles="Super Admin" title="$Resources:adminNav, RoleAdministration"/>
          </siteMapNode>
          ....

    4) Added the role to the admin/web.config:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
      <system.web>
        <pages theme="dashCommerce" />
        <authorization>
           <allow roles="Administrator, Super Admin" />
          <deny users="*" />
        </authorization>
      </system.web>
    </configuration>

Page 1 of 1 (2 items)