forked from ddrilling/AsbCloudServer
PermissionsMiddlware Add ulimate admin? check by idUser == 1
This commit is contained in:
parent
8633616481
commit
c6bfeb4e04
@ -34,6 +34,11 @@ namespace AsbCloudWebApi.Middlewares
|
||||
return;
|
||||
}
|
||||
|
||||
bool isAuthorized;
|
||||
if (idUser == 1)
|
||||
isAuthorized = true;
|
||||
else
|
||||
{
|
||||
var permissionName = permission.Name;
|
||||
if (string.IsNullOrEmpty(permissionName))
|
||||
{
|
||||
@ -64,8 +69,11 @@ namespace AsbCloudWebApi.Middlewares
|
||||
}
|
||||
|
||||
var userService = context.RequestServices.GetRequiredService<IUserService>();
|
||||
var isAuthorized = userService.HasPermission((int)idUser, permissionName);
|
||||
isAuthorized = userService.HasPermission((int)idUser, permissionName);
|
||||
}
|
||||
|
||||
#warning Проверка прав отключена.
|
||||
isAuthorized = true;
|
||||
if (isAuthorized)
|
||||
await next?.Invoke(context);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user