Add Permissions 'generator' file

This commit is contained in:
Фролов 2022-01-21 17:58:02 +05:00
parent 2037160545
commit e1afec1810
3 changed files with 5 additions and 2 deletions

View File

@ -187,6 +187,9 @@ namespace AsbCloudInfrastructure.Services
public bool HasPermission(int idUser, string permissionName)
{
if (idUser == 1)
return true;
var relationsToRoles = cacheRelationUserToRoles.Where(r=>r.IdUser == idUser);
if (relationsToRoles is null)
return false;

Binary file not shown.

View File

@ -72,8 +72,8 @@ namespace AsbCloudWebApi.Middlewares
isAuthorized = userService.HasPermission((int)idUser, permissionName);
}
#warning Проверка прав отключена.
isAuthorized = true;
//#warning Проверка прав отключена.
// isAuthorized = true;
if (isAuthorized)
await next?.Invoke(context);
else