Skip to content

Commit

Permalink
Removed AclModuleNotSupportedException because it is not thrown anywh…
Browse files Browse the repository at this point in the history
…ere and serves no purpose now that we are using DI to inject the ACL modules. Simplified the logic in the CompositeAclModule.
  • Loading branch information
NightOwl888 committed Aug 30, 2013
1 parent 1d43bd1 commit 9314a67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@
<DesignTime>True</DesignTime>
<DependentUpon>Messages.resx</DependentUpon>
</Compile>
<Compile Include="Security\AclModuleNotSupportedException.cs" />
<Compile Include="Security\AuthorizeAttributeAclModule.cs" />
<Compile Include="Security\CompositeAclModule.cs" />
<Compile Include="Security\IAclModule.cs" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace MvcSiteMapProvider.Security
{
/// <summary>
/// CompositeAclModule class
/// Used to chain multiple <see cref="T:MvcSiteMapProvider.Security.IAclModule"/> instances in succession.
/// The builders will be processed in the same order as they are specified in the constructor.
/// </summary>
public class CompositeAclModule
: IAclModule
{
/// <summary>
/// Used to chain several <see cref="T:MvcSiteMapProvider.Security.IAclModule"/> instances in succession.
/// The builders will be processed in the same order as they are specified in the constructor.
/// </summary>
public CompositeAclModule(
params IAclModule[] aclModules
)
Expand All @@ -36,28 +33,16 @@ params IAclModule[] aclModules
/// </returns>
public virtual bool IsAccessibleToUser(ISiteMap siteMap, ISiteMapNode node)
{
// Use child modules
bool result = true;
foreach (var module in aclModules)
{
try
{
result &= module.IsAccessibleToUser(siteMap, node);
}
catch (AclModuleNotSupportedException)
{
result &= true; // Convention throughout the provider: if the IAclModule can not authenticate a user, true is returned.
}
if (result == false)
{
var authorized = module.IsAccessibleToUser(siteMap, node);
if (authorized == false)
return false;
}
}

// Return
return result;
// Convention throughout the provider: if the IAclModule can not authenticate a user, true is returned.
return true;
}

#endregion
}
}
}

0 comments on commit 9314a67

Please sign in to comment.