public async Task <SystemAdminModel> DeleteSystemAdminAsync(string userId)
        {
            SystemAdminInput systemAdminInput = new SystemAdminInput
            {
                UserId = userId,
            };

            return(await this.container.DeleteAsync(systemAdminInput));
        }
예제 #2
0
 public SystemAdminModel(SystemAdminInput systemAdminInput)
 {
     if (systemAdminInput != null)
     {
         this.PartitionKey = systemAdminInput.UserId;
         this.RowKey       = systemAdminInput.UserId;
         this.Name         = systemAdminInput.Name;
     }
 }
예제 #3
0
        public async Task <SystemAdminModel> CreateSystemAdminAsync([FromBody] UserModel model)
        {
            SystemAdminInput systemAdminInput = new SystemAdminInput
            {
                UserId = model.UserId,
                Name   = model.Name,
            };

            return(await this.container.CreateAsync(systemAdminInput));
        }
        public async Task <SystemAdminModel> CreateSystemAdminAsync([FromBody] UserModel model)
        {
            SystemAdminInput systemAdminInput = new SystemAdminInput
            {
                UserId = model.UserId,
                Name   = model.Name,
            };

            var result = await this.container.CreateAsync(systemAdminInput);

            if (result != null)
            {
                await this.AddUserForPendingTenants(result);
            }

            return(result);
        }
예제 #5
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()));
            }
        }