protected async Task <bool> OnSaveAsync(ApiScopeDto dto)
        {
            ResultModel <string> result = new ResultModel <string>();
            var model = new ApiScopeEditDto()
            {
                Enabled     = dto.Enabled,
                Name        = dto.Name,
                DisplayName = dto.DisplayName,
                Description = dto.Description
            };

            if (dto.Id == null)
            {
                model.Id = 0;
                result   = await ApiScopeService.AddApiScope(model);
            }
            else
            {
                model.Id = dto.Id;
                result   = await ApiScopeService.EditApiScope(model);
            }
            if (result.status.code == ResultCode.Success)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        public async Task <IActionResult> OnGetAsync()
        {
            var scopes = await ApiScopeService.GetListAsync();

            this.ApiScopes = Mapper.Map <IEnumerable <IdentityServer4.EntityFramework.Entities.ApiScope>, IEnumerable <ApiScopeVM> >(scopes);
            return(Page());
        }
Example #3
0
 public async Task OnGet()
 {
     this.ApiScopes = (await ApiScopeService.GetListAsync()).Select(x => new ApiScopeVM()
     {
         Name        = x.Name,
         DisplayName = x.DisplayName
     });
 }
Example #4
0
 public ClientsController(ClientService clientService, IdentityResourceService identityResourceService,
                          ApiScopeService apiScopeService, IMapper mapper, ILogger <ClientsController> logger)
 {
     _clientService           = clientService;
     _identityResourceService = identityResourceService;
     _apiScopeService         = apiScopeService;
     _mapper = mapper;
     _logger = logger;
 }
Example #5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                var result = await ApiScopeService.AddAsync(Mapper.Map <IdentityServer4.EntityFramework.Entities.ApiScope>(this.ApiScope));

                return(RedirectToPage("Index"));
            }
            return(Page());
        }
        protected async Task <QueryData <ApiScopeDto> > OnQueryAsync(QueryPageOptions options)
        {
            var result = await ApiScopeService.GetApiScopePage(new ApiScopeQueryDto
            {
                CurrentPage = options.PageIndex,
                PageSize    = options.PageItems,
                Name        = SearchModel.Name,
            });

            if (result.status.code == ResultCode.Success)
            {
                return(new QueryData <ApiScopeDto>
                {
                    Items = result.custom.Data,
                    TotalCount = result.custom.TotalCount,
                    IsSorted = false,
                    IsFiltered = false
                });
            }
            return(null);
        }
        private IApiScopeService GetApiScopeService(IApiScopeRepository repository, IApiScopeServiceResources resources, IAuditEventLogger auditEventLogger)
        {
            IApiScopeService apiScopeService = new ApiScopeService(resources, repository, auditEventLogger);

            return(apiScopeService);
        }
        private async Task GetApiScopeAsync()
        {
            var list = await ApiScopeService.GetAllApiScope();

            ApiScopes = list.custom.Select(x => x.Name).ToList();
        }
 public ApiScopesController(ApiScopeService apiScopeService, IMapper mapper, ILogger <ApiScopesController> logger)
 {
     _apiScopeService = apiScopeService;
     _mapper          = mapper;
     _logger          = logger;
 }