Exemplo n.º 1
0
        public virtual async Task <SystemAdminModel> DeleteAsync(SystemAdminInput input)
        {
            SystemAdminListModel model = await this.GetAsync(input);

            if (model == null)
            {
                string           errorMessage = $"Super user  does not exist with {input.UserId}";
                StorageException exception    = new StorageException(errorMessage);
                this.logger.LogError(exception, errorMessage);
                throw exception;
            }
            else
            {
                return(await this.TableStorageClient.DeleteAsync <SystemAdminModel>(this.TableName, model.Models.FirstOrDefault()));
            }
        }
Exemplo n.º 2
0
        private async Task GenerateSystemAdminClaim(List <Claim> claims)
        {
            string userName         = claims.Where(c => c.Type == "name").First().Value;
            string userId           = claims.Where(c => c.Type == "sub").First().Value;
            string systemAdminClaim = "is_systemAdmin";

            SystemAdminInput     systemAdminInput     = new SystemAdminInput(userId, userName);
            SystemAdminListModel systemAdminListModel = await this.systemAdminContainer.GetAsync(systemAdminInput);

            if (systemAdminListModel.Models != null && systemAdminListModel.Models.Count() > 0)
            {
                claims.Add(new Claim(systemAdminClaim, true.ToString(), ClaimValueTypes.Boolean.ToString()));
            }
            else
            {
                claims.Add(new Claim(systemAdminClaim, false.ToString(), ClaimValueTypes.Boolean.ToString()));
            }
        }