Allow apikey to authenticate as admin

This commit is contained in:
crobibero
2020-10-14 17:58:33 -06:00
parent 8ffa14e6d3
commit 39924f9992
4 changed files with 77 additions and 73 deletions

View File

@@ -19,12 +19,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
public AuthorizationInfo Authenticate(HttpRequest request)
{
var auth = _authorizationContext.GetAuthorizationInfo(request);
if (auth?.User == null)
{
return null;
}
if (auth.User.HasPermission(PermissionKind.IsDisabled))
if (auth.User?.HasPermission(PermissionKind.IsDisabled) ?? false)
{
throw new SecurityException("User account has been disabled.");
}