Use WindowsPrincipal everywhere
This commit is contained in:
parent
f70313c17a
commit
d864418083
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Security.Principal;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
|
|
@ -109,8 +110,7 @@ namespace MusicStore
|
||||||
// administrator. But this can be changed to suit the needs.
|
// administrator. But this can be changed to suit the needs.
|
||||||
var identity = (ClaimsIdentity)context.User.Identity;
|
var identity = (ClaimsIdentity)context.User.Identity;
|
||||||
|
|
||||||
if (context.User.Identity.Name == Environment.GetEnvironmentVariable("USERDOMAIN") + "\\"
|
if (context.User.Identity.Name == WindowsPrincipal.Current.Identity.Name)
|
||||||
+ Environment.GetEnvironmentVariable("USERNAME"))
|
|
||||||
{
|
{
|
||||||
identity.AddClaim(new Claim("ManageStore", "Allowed"));
|
identity.AddClaim(new Claim("ManageStore", "Allowed"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue