/// <summary> /// Inserts an ACL record /// </summary> /// <typeparam name="T">Type</typeparam> /// <param name="customerRoleId">Customer role id</param> /// <param name="entity">Entity</param> public virtual void InsertAclRecord <T>(T entity, int customerRoleId) where T : BaseEntity, IAclSupported { if (entity == null) { throw new ArgumentNullException("entity"); } if (customerRoleId == 0) { throw new ArgumentOutOfRangeException("customerRoleId"); } int entityId = entity.Id; string entityName = typeof(T).Name; var aclRecord = new AclRecord { EntityId = entityId, EntityName = entityName, CustomerRoleId = customerRoleId }; InsertAclRecord(aclRecord); //_unitOfWork.Commit(); }
public virtual void DeleteAclRecord(AclRecord aclRecord) { Guard.NotNull(aclRecord, nameof(aclRecord)); _aclRecordRepository.Delete(aclRecord); ClearCacheSegment(aclRecord.EntityName, aclRecord.EntityId); }
public virtual void InsertAclRecord(AclRecord aclRecord) { Guard.NotNull(aclRecord, nameof(aclRecord)); _aclRecordRepository.Insert(aclRecord); _cacheManager.RemoveByPattern(ACLRECORD_PATTERN_KEY); }
/// <summary> /// Updates the ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void UpdateAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException("aclRecord"); } _aclRecordRepository.Update(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void InsertAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException("aclRecord"); } _aclRecordRepository.Insert(aclRecord); //_unitOfWork.Commit(); }
/// <summary> /// Updates the ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void UpdateAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException("aclRecord"); } _aclRecordRepository.Update(aclRecord); _cacheManager.RemoveByPattern(ACLRECORD_PATTERN_KEY); }
/// <summary> /// Deletes an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void DeleteAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException(nameof(aclRecord)); } _aclRecordRepository.Delete(aclRecord); //event notification _eventPublisher.EntityDeleted(aclRecord); }
/// <summary> /// Deletes an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void DeleteAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException(nameof(aclRecord)); } _aclRecordRepository.Delete(aclRecord); //cache _cacheManager.RemoveByPattern(ACLRECORD_PATTERN_KEY); }
public Task InsertAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException(nameof(aclRecord)); } _aclRecordRepository.Insert(aclRecord); _staticCacheManager.RemoveByPattern(SecurityDefaults.AclRecordPatternCacheKey); return(Task.CompletedTask); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void InsertAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException(nameof(aclRecord)); } _aclRecordRepository.Insert(aclRecord); //cache _cacheManager.RemoveByPrefix(NopSecurityDefaults.AclRecordPrefixCacheKey); //event notification _eventPublisher.EntityInserted(aclRecord); }
public void DeleteAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException("aclRecord"); } _aclRecordRepository.Delete(aclRecord); //cache _cacheManager.RemoveByPattern(ACLRECORD_PATTERN_KEY); //event notification _eventPublisher.EntityDeleted(aclRecord); }
/// <summary> /// Updates the ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void UpdateAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException(nameof(aclRecord)); } _aclRecordRepository.Update(aclRecord); //cache _cacheManager.RemoveByPattern(ACLRECORD_PATTERN_KEY); //event notification _eventPublisher.EntityUpdated(aclRecord); }
/// <summary> /// Deletes an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual async Task DeleteAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException("aclRecord"); } await _aclRecordRepository.DeleteAsync(aclRecord); //cache await _cacheManager.RemoveByPattern(ACLRECORD_PATTERN_KEY); //event notification await _mediator.EntityDeleted(aclRecord); }
/// <summary> /// Deletes an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void DeleteAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException(nameof(aclRecord)); } _aclRecordRepository.Delete(aclRecord); //cache _cacheManager.RemoveByPattern(NopSecurityDefaults.AclRecordPatternCacheKey); //event notification _eventPublisher.EntityDeleted(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual async Task InsertAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException("aclRecord"); } await _aclRecordRepository.InsertAsync(aclRecord); //cache _cacheManager.RemoveByPattern(ACLRECORD_PATTERN_KEY); //event notification await _eventPublisher.EntityInserted(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual async Task InsertAclRecord(AclRecord aclRecord) { if (aclRecord == null) { throw new ArgumentNullException("aclRecord"); } await _aclRecordRepository.InsertAsync(aclRecord); //cache await _cacheBase.RemoveByPrefix(CacheKey.ACLRECORD_PATTERN_KEY); //event notification await _mediator.EntityInserted(aclRecord); }
public void Can_save_and_load_urlRecord() { var aclRecord = new AclRecord { EntityId = 1, EntityName = "EntityName 1", CustomerRole = GetTestCustomerRole(), }; var fromDb = SaveAndLoadEntity(aclRecord); fromDb.ShouldNotBeNull(); fromDb.EntityId.ShouldEqual(1); fromDb.EntityName.ShouldEqual("EntityName 1"); fromDb.CustomerRole.ShouldNotBeNull(); }
public virtual void InsertAclRecord <T>(T entity, int customerRoleId) where T : BaseEntity, IAclSupported { Guard.NotNull(entity, nameof(entity)); if (customerRoleId == 0) { throw new ArgumentOutOfRangeException(nameof(customerRoleId)); } int entityId = entity.Id; string entityName = entity.GetEntityName(); var aclRecord = new AclRecord { EntityId = entityId, EntityName = entityName, CustomerRoleId = customerRoleId }; InsertAclRecord(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="entityName">Type</param> /// <param name="customerRoleId">Customer role id</param> /// <param name="entity">Entity</param> public virtual void InsertAclRecord(string entityName, dynamic entity, int customerRoleId) { if (entity == null) { throw new ArgumentNullException("entity"); } if (customerRoleId == 0) { throw new ArgumentOutOfRangeException("customerRoleId"); } int entityId = entity.Id; var aclRecord = new AclRecord { EntityId = entityId, EntityName = entityName, CustomerRoleId = customerRoleId }; InsertAclRecord(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <typeparam name="T">Type</typeparam> /// <param name="customerRoleId">Customer role id</param> /// <param name="entity">Entity</param> public virtual void InsertAclRecord <T>(T entity, string customerRoleId) where T : BaseEntity, IAclSupported { if (entity == null) { throw new ArgumentNullException("entity"); } if (String.IsNullOrEmpty(customerRoleId)) { throw new ArgumentOutOfRangeException("customerRoleId"); } string entityId = entity.Id; string entityName = typeof(T).Name; var aclRecord = new AclRecord { EntityId = entityId, EntityName = entityName, CustomerRoleId = customerRoleId }; InsertAclRecord(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <typeparam name="T">Type</typeparam> /// <param name="entity">Entity</param> /// <param name="userRoleId">User role id</param> public virtual void InsertAclRecord <T>(T entity, int userRoleId) where T : BaseEntity, IAclSupported { if (entity == null) { throw new ArgumentNullException("entity"); } if (userRoleId == 0) { throw new ArgumentOutOfRangeException("userRoleId"); } int entityId = entity.Id; string entityName = typeof(T).Name; var aclRecord = new AclRecord() { EntityId = entityId, EntityName = entityName, UserRoleId = userRoleId }; InsertAclRecord(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <typeparam name="T">Type</typeparam> /// <param name="userRoleId">User role id</param> /// <param name="entity">Entity</param> public virtual void InsertAclRecord <T>(T entity, Guid userRoleId) where T : BaseEntity, IAclSupported { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (userRoleId == default(Guid)) { throw new ArgumentOutOfRangeException("userRoleId"); } var entityId = entity.Id; var entityName = entity.GetType().BaseType.Name; var aclRecord = new AclRecord { EntityId = entityId, EntityName = entityName, UserRoleId = userRoleId }; InsertAclRecord(aclRecord); }
public async Task InsertAclRecord <T>(T entity, int roleId) where T : BaseEntity, IAclSupported { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (roleId == 0) { throw new ArgumentOutOfRangeException(nameof(roleId)); } var entityId = entity.Id; var entityName = entity.GetUnproxiedEntityType().Name; var aclRecord = new AclRecord { EntityId = entityId, EntityName = entityName, RoleId = roleId }; await InsertAclRecord(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <typeparam name="TEntity">Type of entity that supports the ACL</typeparam> /// <param name="entity">Entity</param> /// <param name="customerRoleId">Customer role id</param> /// <returns>A task that represents the asynchronous operation</returns> public virtual async Task InsertAclRecordAsync <TEntity>(TEntity entity, int customerRoleId) where TEntity : BaseEntity, IAclSupported { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (customerRoleId == 0) { throw new ArgumentOutOfRangeException(nameof(customerRoleId)); } var entityId = entity.Id; var entityName = entity.GetType().Name; var aclRecord = new AclRecord { EntityId = entityId, EntityName = entityName, CustomerRoleId = customerRoleId }; await InsertAclRecordAsync(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <typeparam name="T">Type</typeparam> /// <param name="customerRoleId">Customer role id</param> /// <param name="entity">Entity</param> public virtual void InsertAclRecord <T>(T entity, int customerRoleId) where T : BaseEntity, IAclSupported { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (customerRoleId == 0) { throw new ArgumentOutOfRangeException("customerRoleId"); } var entityId = entity.Id; var entityName = entity.GetUnproxiedEntityType().Name; var aclRecord = new AclRecord { EntityId = entityId, EntityName = entityName, CustomerRoleId = customerRoleId }; InsertAclRecord(aclRecord); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> /// <returns>A task that represents the asynchronous operation</returns> protected virtual async Task InsertAclRecordAsync(AclRecord aclRecord) { await _aclRecordRepository.InsertAsync(aclRecord); }
/// <summary> /// Deletes an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> /// <returns>A task that represents the asynchronous operation</returns> public virtual async Task DeleteAclRecordAsync(AclRecord aclRecord) { await _aclRecordRepository.DeleteAsync(aclRecord); }
public void UpdateAclRecord(AclRecord aclRecord) { throw new NotImplementedException(); }
public void InsertAclRecord(AclRecord aclRecord) { throw new NotImplementedException(); }
/// <summary> /// Inserts an ACL record /// </summary> /// <param name="aclRecord">ACL record</param> public virtual void InsertAclRecord(AclRecord aclRecord) { _aclRecordRepository.Insert(aclRecord); }