[Mono-dev] SiteMapProvider patch

Konstantin Triger kostat at mainsoft.com
Wed May 30 02:11:24 EDT 2007


Hey Dumitru,

 

The problem is probably in case #1:

 

/* 1. */

IList roles = node.Roles;

if (roles != null && roles.Count > 0) {

      foreach (string rolename in roles)

            if (rolename == "*" || context.User.IsInRole (rolename))

                  return true;

      return false;

}

 

Either the rolename is not parsed correctly or context.User.IsInRole (rolename) works wrong. To check the later, you may run 'context.User.IsInRole ("Administrator")' within your user code and see the result.

 

Regards,

Konstantin Triger

________________________________

From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Dumitru Ban
Sent: Tuesday, May 29, 2007 11:45 AM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-dev] SiteMapProvider patch

 

Hi,

 

I'm trying to create a patch for SiteMapProvider->IsAccessibleToUser method.

 

Let's say a web.sitemap file is present, having the following content:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
 <siteMapNode url="home.aspx" title="Home">
  <siteMapNode title="Test_no_url_no_roles"/>
  <siteMapNode title="Test_no_url_roles"  roles="Administrator"/>
  </siteMapNode>
</siteMap>

 

With Microsoft .NET, the "Test_no_url_no_roles" node is not accessible to any user and the "Test_no_url_roles" is accessible only to an Administrator.

In mono, both nodes are accessible to anyone. And this is because if the url of the node is null or is the empty string, the method returns true.

 

On the method there is a [MonoTODO ("need to implement cases 2 and 3")]. But number 2 is already started and the code

String url = node.Url;

if (String.IsNullOrEmpty(url))

    return true;

is already there. 

Shouldn't we have the same behaviour as Microsoft .NET?

 

Thanks & best regards,

Dumi.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070529/b8e87189/attachment.html 


More information about the Mono-devel-list mailing list