Permalink
Browse files

Fixes

  • Loading branch information...
1 parent 3a72f18 commit 4481b045b17e536438595684bf21985df165f14d @jgauffin committed Apr 30, 2012
View
@@ -37,6 +37,19 @@ documentation/Help/*.xml
documentation/Help/*.bmp
documentation/Help/*.ico
documentation/Help/*.gif
+*/Help/html/
+*/Help/fti/
+*/Help/*/
+*/Help/*.png
+*/Help/*.js
+/Help/*.aspx
+/Help/*.html
+/Help/*.config
+/Help/*.css
+/Help/*.xml
+/Help/*.bmp
+/Help/*.ico
+/Help/*.gif
icons
[Rr]elease*/
_ReSharper*/
Binary file not shown.
Binary file not shown.
@@ -24,5 +24,11 @@ public interface IMenuItem
/// <param name="helper">Uri helper (to be able to generate absolute uris)</param>
/// <returns>Created URI</returns>
Uri CreateUri(UrlHelper helper);
+
+ /// <summary>
+ /// Gets if the item is visible (user have the correct role)
+ /// </summary>
+ /// <returns>true if user has the correct role; otherwise false.</returns>
+ bool IsVisible { get; }
}
}
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
+using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
@@ -57,7 +58,7 @@ public RoutedMenuItem(string name, string title, object route)
/// </remarks>
public Uri CreateUri(UrlHelper helper)
{
- var routeName = (string) _route["area"];
+ var routeName = (string)_route["area"];
if (routeName != null)
{
_route.Remove("area");
@@ -68,6 +69,21 @@ public Uri CreateUri(UrlHelper helper)
}
/// <summary>
+ /// Gets if the item is visible (user have the correct role)
+ /// </summary>
+ /// <returns>true if user has the correct role; otherwise false.</returns>
+ public bool IsVisible
+ {
+ get { return string.IsNullOrEmpty(RoleName) | HttpContext.Current.User.IsInRole(RoleName); }
+ }
+
+ /// <summary>
+ /// Gets or sets the role that the user must have.
+ /// </summary>
+ /// <remarks>Set as <c>null</c> to disable role checking</remarks>
+ public string RoleName { get; set; }
+
+ /// <summary>
/// Gets the enumerator.
/// </summary>
/// <returns> </returns>
@@ -37,5 +37,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.4.0")]
-[assembly: AssemblyFileVersion("1.0.4.0")]
+[assembly: AssemblyVersion("1.0.5.1")]
+[assembly: AssemblyFileVersion("1.0.5.1")]
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Web;
namespace Griffin.MvcContrib.VirtualPathProvider
{
@@ -23,6 +24,7 @@ public string GetFullPath(string uri)
{
if (uri == null) throw new ArgumentNullException("uri");
+ uri = VirtualPathUtility.ToAbsolute(uri);
var mapping = _mappings.OrderByDescending(x => x.Uri.Length).FirstOrDefault(x => uri.StartsWith(x.Uri));
if (mapping == null)
return null;
@@ -48,7 +50,7 @@ public void Add(string rootUri, string rootPath)
if (rootPath == null) throw new ArgumentNullException("rootPath");
_mappings.Add(new Mapping
{
- Uri = rootUri,
+ Uri = VirtualPathUtility.ToAbsolute(rootUri),
DiskRoot = rootPath
});
}
@@ -5,6 +5,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
+using System.Web;
using System.Web.Caching;
using System.Web.Hosting;
using System.Web.Mvc;
@@ -153,18 +154,12 @@ private Stream CorrectView(string virtualPath, Stream stream)
/// <returns> Full resource name if found; otherwise null. </returns>
private MappedResource GetResource(string uri)
{
- uri = uri.TrimStart('~', '/').TrimEnd('/');
- uri = uri.Replace('/', '.');
+ var uri2 = VirtualPathUtility.ToAbsolute(uri);
+ uri2 = uri2.TrimStart('/').TrimEnd('/');
+ uri2 = uri2.Replace('/', '.');
var result =
_resourceNames.FirstOrDefault(
- resource => resource.ResourceName.Equals(uri, StringComparison.OrdinalIgnoreCase));
- if (result == null)
- {
- uri = uri.Replace("MyIT.WebClient.", "");
- result =
- _resourceNames.FirstOrDefault(
- resource => resource.ResourceName.Equals(uri, StringComparison.OrdinalIgnoreCase));
- }
+ resource => resource.ResourceName.Equals(uri2, StringComparison.OrdinalIgnoreCase));
if (result != null)
{
Debug.WriteLine("Exists: " + uri);
@@ -13,7 +13,7 @@ namespace Griffin.MvcContrib.VirtualPathProvider
/// </summary>
/// <remarks>
/// <para>
- /// You can easily use embedded views (using class libraries for Controllers & Views) by configuration MVC like this:
+ /// You can easily use embedded views (using class libraries for Controllers &amp; Views) by configuration MVC like this:
/// <example>
/// <code>
/// // you can assign a custom WebViewPage or a custom layout.

0 comments on commit 4481b04

Please sign in to comment.