public Permissions(GetCRUD getcrud, IHttpContextAccessor context, IPermissionsDAL _permissionsDal, ILogger <Permissions <T> > logger) { _crud = getcrud(typeof(IPermissions <>), typeof(T)) as ICRUD <T>; _logger = logger; permissionsDal = _permissionsDal; try { var roles = context.HttpContext.User.Claims.Where(c => c.Type == ClaimTypes.Role).Select(c => c.Value).ToList(); var permissions = permissionsDal.GetPermissionsForType( typeof(T).FullName, typeof(T).Assembly.GetName().Name, roles); _allowCreate = permissions.Any(p => p.AllowCreate); _allowDelete = permissions.Any(p => p.AllowDelete); _allowGet = permissions.Any(p => p.AllowRead); _allowUpdate = permissions.Any(p => p.AllowWrite); //все критерии для переданного типа var typeCriterions = permissionsDal.GetTypeCriterions(typeof(T).FullName, typeof(T).Assembly.GetName().Name); foreach (var crit in typeCriterions) { var exp = DynamicExpressionParser.ParseLambda(typeof(T), typeof(bool), crit.Criteria, null); var _del = exp.Compile(); _typeExpressions.Add(new ExpressionCheck { ExpressionDel = _del, AllowCreate = crit.AllowCreate, AllowDelete = crit.AllowDelete, AllowRead = crit.AllowRead, AllowWrite = crit.AllowWrite }); } } catch { _logger.LogInformation("Ошибка получения ролей текущего пользователя"); } }
public FormatDAL(GetCRUD getcrud) { _formats_crud = getcrud(typeof(FormatDAL), typeof(Format)) as ICRUD <Format>; }
public ProviderDAL(GetCRUD getcrud, ICRUD <ProvidersTechnicalService> providers_techServs_crud) { _providers_crud = getcrud(typeof(ProviderDAL), typeof(Provider)) as ICRUD <Provider>; _providers_techServs_crud = providers_techServs_crud; }
public BudgetLineDAL(GetCRUD getcrud, WBSContext context) { _budgetLine_crud = getcrud(typeof(BudgetLineDAL), typeof(BudgetLine)) as ICRUD <BudgetLine>; }
public RoleObjectTypesDAL(GetCRUD getcrud) { _roles_object_types = getcrud(typeof(RoleObjectTypesDAL), typeof(RolesObjectTypes)) as ICRUD <RolesObjectTypes>; }
public EventsDAL(GetCRUD getcrud) { _events_crud = getcrud(typeof(EventsDAL), typeof(Event)) as ICRUD <Event>; }
public RationaleForInvestmentsDAL(GetCRUD getcrud) { _rationalies_for_inv_crud = getcrud(typeof(RationaleForInvestmentsDAL), typeof(RationaleForInvestment)) as ICRUD <RationaleForInvestment>; }
public TechnicalServiceDAL(GetCRUD getcrud) { _technical_services_crud = getcrud(typeof(TechnicalServiceDAL), typeof(TechnicalService)) as ICRUD <TechnicalService>; }
public RequestLineDAL(GetCRUD getcrud, WBSContext context) { _requestLine_crud = getcrud(typeof(RequestLineDAL), typeof(RequestLine)) as ICRUD <RequestLine>; }
public AttachmentDAL(GetCRUD getcrud) { _attachments_crud = getcrud(typeof(AttachmentDAL), typeof(Attachment)) as ICRUD <Attachment>; }
public ProfilesDAL(GetCRUD getcrud, ICRUD <UserRoles> users_roles_crud, ICRUD <Role> roles_crud) { _users_crud = getcrud(typeof(ProfilesDAL), typeof(User)) as ICRUD <User>; _user_roles_crud = users_roles_crud; _roles_crud = roles_crud; }
public BudgetPlanDAL(GetCRUD getcrud, WBSContext ctx) { _bp_crud = getcrud(typeof(BudgetPlanDAL), typeof(BudgetPlan)) as ICRUD <BudgetPlan>; _events_crud = getcrud(typeof(BudgetPlanDAL), typeof(Event)) as ICRUD <Event>; _statuses_crud = getcrud(typeof(BudgetPlanDAL), typeof(Status)) as ICRUD <Status>; }
public TypesOfInvestmentDAL(GetCRUD getcrud) { _types_of_inv_crud = getcrud(typeof(TypesOfInvestmentDAL), typeof(TypeOfInvestment)) as ICRUD <TypeOfInvestment>; }
public ResultCentresDAL(GetCRUD getcrud) { _result_centers_crud = getcrud(typeof(ResultCentresDAL), typeof(ResultCenter)) as ICRUD <ResultCenter>; }
public SiteDAL(GetCRUD getcrud) { _sites_crud = getcrud(typeof(SiteDAL), typeof(Site)) as ICRUD <Site>; }
public CategoryGroupsDAL(GetCRUD getcrud) { _categories_groups_crud = getcrud(typeof(CategoryGroupsDAL), typeof(CategoryGroup)) as ICRUD <CategoryGroup>; }
public CrudCache(GetCRUD getcrud, IMemoryCache cache, GetExpirationTime getexptime) { _crud = getcrud(typeof(ICRUDCache <>), typeof(T)) as ICRUD <T>; _cache = cache; _expiration = getexptime(); }
public RolesDAL(GetCRUD getcrud) { _roles_crud = getcrud(typeof(RolesDAL), typeof(Role)) as ICRUD <Role>; }
public CategoriesOfEquipmentDAL(GetCRUD getcrud) { _categories_of_equipment_crud = getcrud(typeof(CategoriesOfEquipmentDAL), typeof(CategoryOfEquipment)) as ICRUD <CategoryOfEquipment>; }
public DAIRequestDAL(GetCRUD getcrud) { _dai_requests_crud = getcrud(typeof(DAIRequestDAL), typeof(DAIRequest)) as ICRUD <DAIRequest>; _dai_requests_tech_services_crud = getcrud(typeof(DAIRequestDAL), typeof(DAIRequestsTechnicalService)) as ICRUD <DAIRequestsTechnicalService>; }