Rylan is awesome.

This commit is contained in:
Michael 2017-05-09 20:10:28 -04:00
parent 9c5d57e4f5
commit 7e0dfbb778

View file

@ -435,18 +435,24 @@ public static bool IsGuest(this IIdentity id)
public static bool IsModerator(this IIdentity id)
{
if (!HttpContext.Current.Request.IsAuthenticated)
return false;
var db = new ApplicationDbContext();
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsModerator;
}
public static bool IsDeveloper(this IIdentity id)
{
if (!HttpContext.Current.Request.IsAuthenticated)
return false;
var db = new ApplicationDbContext();
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsDeveloper;
}
public static bool IsMember(this IIdentity id)
{
if (!HttpContext.Current.Request.IsAuthenticated)
return false;
var db = new ApplicationDbContext();
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsMember;
}
@ -454,6 +460,8 @@ public static bool IsMember(this IIdentity id)
public static bool IsAdmin(this IIdentity id)
{
if (!HttpContext.Current.Request.IsAuthenticated)
return false;
var db = new ApplicationDbContext();
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsAdmin;
}