示例#1
0
 private ProjectUsersUpdateResult ExecuteAddRoleRequest(string userId, string url, string roleUri)
 {
     var payload = new ProjectUserRequest {
         User = new ProjectUserRequest.UserRequest {
             Content = new ProjectUserRequest.UserRequest.ContentRequest {
                 Status = "ENABLED",
                 UserRoles = new List<string> { roleUri }
             },
             Links = new ProjectUserRequest.UserRequest.LinksRequest {
                 Self = Url.Combine(Constants.PROFILE_URI, userId)
             }
         }
     };
     var response = JsonPostRequest(url, payload);
     var assignResponse = JsonConvert.DeserializeObject(response, typeof(ProjectUserRequestResponse)) as ProjectUserRequestResponse;
     return assignResponse.ProjectUsersUpdateResult;
 }
示例#2
0
 public void UpdateProjectUserAccess(string projectId, string profileId, bool enabled, string roleName = SystemRoles.DashboardOnly)
 {
     CheckAuthentication();
     var role = FindRoleByTitle(projectId, roleName);
     var url = Url.Combine(Config.ServiceUrl, Constants.PROJECTS_URI, projectId, Constants.PROJECT_USERS_SUFFIX);
     var payload = new ProjectUserRequest {
         User = new ProjectUserRequest.UserRequest {
             Content = new ProjectUserRequest.UserRequest.ContentRequest {
                 Status = (enabled) ? "ENABLED" : "DISABLED",
                 UserRoles = new List<string> { role.Meta.Uri }
             },
             Links = new ProjectUserRequest.UserRequest.LinksRequest {
                 Self = Url.Combine(Constants.PROFILE_URI, profileId)
             }
         }
     };
     JsonPostRequest(url, payload);
 }