Ejemplo n.º 1
0
        public async Task <IActionResult> AvailableScopes()
        {
            var organisationIds = JsonSerializer.Deserialize <List <Guid> >(
                TempData.Peek(_selectedOrganisationIds)
                .ToString());
            var currentRoleUserEmail = HttpContext.Session.GetString(_roleUserEmail);
            var authorisedOrgIds     = HttpContext.User.GetOrganisationIds();
            var model = new AvailableScopesViewModel()
            {
                AvailableScopes = await _identityManagementRepository
                                  .GetAccessibleOrganisationScopesAsync(organisationIds, currentRoleUserEmail, authorisedOrgIds)
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AvailableScopes(AvailableScopesViewModel model)
        {
            if (!ModelState.IsValid)
            {
                var selectedOrganisationIds = JsonSerializer.Deserialize <List <Guid> >(
                    TempData.Peek(_selectedOrganisationIds)
                    .ToString());
                var currentRoleUserEmail = HttpContext.Session.GetString(_roleUserEmail);
                var authorisedOrgIds     = HttpContext.User.GetOrganisationIds();
                model.AvailableScopes = await _identityManagementRepository
                                        .GetAccessibleOrganisationScopesAsync(selectedOrganisationIds, currentRoleUserEmail, authorisedOrgIds);

                return(View(model));
            }

            TempData[_selectedScopes] = JsonSerializer.Serialize(model.SelectedScopes);

            return(RedirectToAction(nameof(CreateClientCredentials)));
        }