mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 17:22:15 +00:00
Rylan is awesome.
This commit is contained in:
parent
9c5d57e4f5
commit
7e0dfbb778
1 changed files with 8 additions and 0 deletions
|
@ -435,18 +435,24 @@ public static bool IsGuest(this IIdentity id)
|
||||||
|
|
||||||
public static bool IsModerator(this IIdentity id)
|
public static bool IsModerator(this IIdentity id)
|
||||||
{
|
{
|
||||||
|
if (!HttpContext.Current.Request.IsAuthenticated)
|
||||||
|
return false;
|
||||||
var db = new ApplicationDbContext();
|
var db = new ApplicationDbContext();
|
||||||
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsModerator;
|
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsModerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsDeveloper(this IIdentity id)
|
public static bool IsDeveloper(this IIdentity id)
|
||||||
{
|
{
|
||||||
|
if (!HttpContext.Current.Request.IsAuthenticated)
|
||||||
|
return false;
|
||||||
var db = new ApplicationDbContext();
|
var db = new ApplicationDbContext();
|
||||||
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsDeveloper;
|
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsDeveloper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsMember(this IIdentity id)
|
public static bool IsMember(this IIdentity id)
|
||||||
{
|
{
|
||||||
|
if (!HttpContext.Current.Request.IsAuthenticated)
|
||||||
|
return false;
|
||||||
var db = new ApplicationDbContext();
|
var db = new ApplicationDbContext();
|
||||||
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsMember;
|
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)
|
public static bool IsAdmin(this IIdentity id)
|
||||||
{
|
{
|
||||||
|
if (!HttpContext.Current.Request.IsAuthenticated)
|
||||||
|
return false;
|
||||||
var db = new ApplicationDbContext();
|
var db = new ApplicationDbContext();
|
||||||
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsAdmin;
|
return db.Users.FirstOrDefault(x => x.UserName == id.Name).HighestRole.IsAdmin;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue