public AuthorityProvider( [NotNull] IAuthorityRepository authorityRepository, [NotNull] IRoleAuthorityRepository roleAuthorityRepository) { _authorityRepository = authorityRepository; _roleAuthorityRepository = roleAuthorityRepository; }
/// <summary> /// Initializes a new instance of the <see cref="InvoiceService"/> class. /// </summary> /// <param name="invoiceRepository"> /// The invoice repository. /// </param> /// <param name="recipientRepository"> /// The recipient Repository. /// </param> /// <param name="authorityRepository"> /// The authority Repository. /// </param> /// <param name="invoiceItemRepository"> /// The invoice Item Repository. /// </param> public InvoiceService(IInvoiceRepository invoiceRepository, IRecipientRepository recipientRepository, IAuthorityRepository authorityRepository, IInvoiceItemRepository invoiceItemRepository) { this.invoiceRepository = invoiceRepository; this.recipientRepository = recipientRepository; this.authorityRepository = authorityRepository; this.invoiceItemRepository = invoiceItemRepository; }
/// <summary> /// 实例化一个权限对象 /// </summary> /// <param name="code">权限码</param> /// <param name="name">权限名称</param> public Authority(string code = "", string name = "") { _code = code; _name = name; _status = AuthorityStatus.启用; _authGroup = new LazyMember <AuthorityGroup>(LoadAuthorityGroup); _authType = AuthorityType.管理; _createDate = DateTime.Now; _sort = 0; authorityRepository = this.Instance <IAuthorityRepository>(); }
public GetAuthoritiesListResponse GetAuthoritiesList(GetAuthoritiesListRequest request) { GetAuthoritiesListResponse response = new GetAuthoritiesListResponse(); try { using (IUnitOfWork unitOfWork = RepositoryFactory.GetUnitOfWork()) { if (request != null) { IAuthorityRepository authorityRepository = RepositoryFactory.Get(typeof(IAuthorityRepository), unitOfWork) as IAuthorityRepository; List <Authority> authorities = authorityRepository.GetAll().ToList(); unitOfWork.Commit(); if (authorities != null) { foreach (var item in authorities) { ViewModels.AuthorityView node = new ViewModels.AuthorityView() { Id = item.Id, Name = item.Name }; if (response.Authorities == null) { response.Authorities = new List <ViewModels.AuthorityView>(); } response.Authorities.Add(node); } response.IsSucess = true; } else { response.IsSucess = false; response.Message = "No Authority!"; } } else { response.IsSucess = false; response.Message = "No Input!"; } } } catch (Exception ex) { Log.Write(ex.Message); response.IsSucess = false; response.Message = ex.Message; } return(response); }
public ApiScopeManager(IAuthorityRepository repository) { _repository = repository; }
public ClientManager(IAuthorityRepository repository) { _repository = repository; }
public GetRolesListResponse GetRolesList(GetRolesListRequest request) { GetRolesListResponse response = new GetRolesListResponse(); try { using (IUnitOfWork unitOfWork = RepositoryFactory.GetUnitOfWork()) { if (request != null) { IRoleRepository roleRepository = RepositoryFactory.Get(typeof(IRoleRepository), unitOfWork) as IRoleRepository; IAuthorizeRepository authorizeRepository = RepositoryFactory.Get(typeof(IAuthorizeRepository), unitOfWork) as IAuthorizeRepository; IAuthorityRepository authorityRepositroy = RepositoryFactory.Get(typeof(IAuthorityRepository), unitOfWork) as IAuthorityRepository; List <Authorize> authorizes = authorizeRepository.GetAll().ToList(); List <Authority> authorities = authorityRepositroy.GetAll().ToList(); List <Role> roles = roleRepository.GetAll().ToList(); unitOfWork.Commit(); if (authorities != null && authorizes != null && roles != null) { response.Roles = new List <ViewModels.RoleView>(); foreach (var item in roles) { ViewModels.RoleView node = new ViewModels.RoleView(); node.Id = item.Id; node.Name = item.Name; List <Authorize> selectedAuthorizes = authorizes.Where(it => it.RoleName.Contains(item.Id)).ToList(); if (selectedAuthorizes != null) { foreach (var seletecd in selectedAuthorizes) { var selectedAuthority = authorities.Where(it => it.Id == seletecd.AuthorityName).FirstOrDefault(); if (selectedAuthority != null) { if (node.Authorities == null) { node.Authorities = new List <ViewModels.AuthorityView>(); } node.Authorities.Add(new ViewModels.AuthorityView() { Id = selectedAuthority.Id, Name = selectedAuthority.Name }); } } } response.Roles.Add(node); } response.IsSucess = true; } else { response.IsSucess = false; response.Message = "no Authority.Authorize.Role in GetRoleList of UserService!"; } } else { response.IsSucess = false; response.Message = "No Input!"; } } } catch (Exception ex) { Log.Write(ex.Message); response.IsSucess = false; response.Message = ex.Message; } return(response); }
/// <summary> /// 依赖注入构造器 /// </summary> public RepositoryMediator(IInfoSystemRepository systemRep, IUserRepository userRep, IAuthorityRepository authorityRep, IMenuRepository menuRep, IRoleRepository roleRep, ILoginRecordRepository loginRecordRep) { this.InfoSystemRep = systemRep; this.UserRep = userRep; this.AuthorityRep = authorityRep; this.MenuRep = menuRep; this.RoleRep = roleRep; this.LoginRecordRep = loginRecordRep; }
public AuthorityController(IConfiguration config, IAuthorityRepository authorityRepository) { _config = config; _authorityRepository = authorityRepository; }
/// <summary> /// Constructor with service dependencies injected /// </summary> /// <param name="authorityRepository">Authority Service</param> /// <param name="establishmentRepository">Establishment Service</param> public HomeController(IAuthorityRepository authorityRepository, IEstablishmentRepository establishmentRepository, IRatingKeyRepository ratingKeyRepository) { AuthorityRepository = authorityRepository; EstablishmentRepository = establishmentRepository; RatingKeyRepository = ratingKeyRepository; }
public AuthorityManager(IAuthorityRepository repository) { _repository = repository; }