private async void GrantWindowsAccess(UserRequest request) { try { var client = new HttpClient(); string uri = Configurations.SetWindowsUserAccesssURI; //first and last name ?? var criteria = new svnAccessDTO { repoName = request.RepositoryName, accountID = request.Domain + "\\" + request.Username, path = request.RepositoryPath, permissionEntry = request.permission }; var queryString = new StringContent(JsonConvert.SerializeObject(criteria), Encoding.UTF8, "application/json"); var response = await client.PostAsync(uri, queryString); if (!response.IsSuccessStatusCode) { throw new Exception("failed setting user access"); } } catch (Exception) { throw; } }
private async Task <string> GrantLinuxAccess(UserRequest request) { try { var client = new HttpClient(); string uri = Configurations.SetLinuxUserAccesssURI; var criteria = new svnAccessDTO { repoName = request.RepositoryName, accountID = request.Username, path = request.RepositoryPath, permissionEntry = request.permission, fName = request.FirstName, lName = request.LastName }; var json = JsonConvert.SerializeObject(criteria); var queryString = new StringContent(JsonConvert.SerializeObject(criteria), Encoding.UTF8, "application/json"); var response = await client.PostAsync(uri, queryString); var contents = await response.Content.ReadAsStringAsync(); return(contents); } catch (Exception) { throw; } }