public void CreateUpdateDelete() { var u = new UserUpsert { Email = "*****@*****.**", Bio = "bio", CanCreateGroup = true, IsAdmin = true, Linkedin = null, Name = "sadfasdf", Password = "******", ProjectsLimit = 1000, Provider = "provider", Skype = "skype", Twitter = "twitter", Username = "******", WebsiteURL = "wp.pl" }; var addedUser = _users.Create(u); Assert.AreEqual(u.Bio, addedUser.Bio); u.Bio = "Bio2"; u.Email = "*****@*****.**"; var updatedUser = _users.Update(addedUser.Id, u); Assert.AreEqual(u.Bio, updatedUser.Bio); _users.Delete(addedUser.Id); }
public void ChangeUserPassword(Account account, string newPassword) { Require.NotNull(account, nameof(account)); Require.NotEmpty(newPassword, nameof(newPassword)); var user = new UserUpsert { Password = newPassword }; _gitLabClient.Users.Update(account.GitlabUserId, user); }
public User Update(int id, UserUpsert user) { return _api.Put().With(user).To<User>(User.Url + "/" + id); }
public User Create(UserUpsert user) { return _api.Post().With(user).To<User>(User.Url); }
public User RenameUser(User gitLabUser, string userName, string displayName, string email) { try { var userClient = this.client.Users; var userUpsert = new UserUpsert() { Username = userName, Name = displayName, Email = email, Password = new Guid().ToString() }; return userClient.Update(gitLabUser.Id, userUpsert); } catch (Exception ex) { Log.Error($"Can`t change user {userName} email {email}", ex); throw; } }
public void RegisterUser(string userName, string displayName, string email) { try { var userClient = this.client.Users; var userUpsert = new UserUpsert() { Username = userName, Name = displayName, Email = email, Password = new Guid().ToString() }; userClient.Create(userUpsert); } catch (Exception ex) { Log.Error($"Can`t create user {userName} email {email}", ex); throw; } }
public int RegisterUser(Account account) { var user = new UserUpsert { Email = account.Email.Address, IsAdmin = false, Password = account.Password.Value, //todo ProjectsLimit = 0, Name = account.Firstname + " " + account.Lastname, CanCreateGroup = false, Confirm = "no", Username = GetUserNameByLastName(account.Lastname) }; var addedUser = _gitLabClient.Users.Create(user); return addedUser.Id; }