mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 11:21:47 -05:00
Fix various bugs with permission backend.
This commit is contained in:
parent
b946c99fa6
commit
3e6500f958
1 changed files with 34 additions and 24 deletions
|
@ -73,13 +73,17 @@ protected void Application_BeginRequest(object sender, EventArgs e)
|
|||
mod = act.GetCustomAttributes(false).FirstOrDefault(x => x is RequiresModerator);
|
||||
dev = act.GetCustomAttributes(false).FirstOrDefault(x => x is RequiresDeveloper);
|
||||
|
||||
if (adm != null)
|
||||
fail = fail || (bool)!User.Identity?.IsAdmin();
|
||||
if (mod != null)
|
||||
fail = fail || (bool)!User.Identity?.IsModerator();
|
||||
if (dev != null)
|
||||
fail = fail || (bool)!User.Identity?.IsDeveloper();
|
||||
bool? fail2 = false;
|
||||
|
||||
if (adm != null)
|
||||
fail2 = User.Identity?.IsAdmin();
|
||||
if (mod != null)
|
||||
fail2 = User.Identity?.IsModerator();
|
||||
if (dev != null)
|
||||
fail2 = User.Identity?.IsDeveloper();
|
||||
|
||||
if (fail2 != null)
|
||||
fail = fail || !(bool)fail2;
|
||||
|
||||
if (fail == true)
|
||||
{
|
||||
|
@ -105,6 +109,8 @@ protected void Application_BeginRequest(object sender, EventArgs e)
|
|||
protected void Application_EndRequest(object s, EventArgs e)
|
||||
{
|
||||
var db = new ApplicationDbContext();
|
||||
if (Request.IsAuthenticated)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(User.Identity.Name))
|
||||
{
|
||||
//Check for a username ban.
|
||||
|
@ -158,6 +164,10 @@ you will be IP-banned and this screen won't be as friendly to you.
|
|||
db.SaveChanges();
|
||||
}
|
||||
}
|
||||
CompleteRequest();
|
||||
return;
|
||||
}
|
||||
CompleteRequest();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue