/// <summary>
        /// Initializes a new instance of the <see cref="UpdateUserRequest"/> class
        /// with the specified user.
        /// </summary>
        /// <param name="user">A <see cref="User"/> instance containing the updated details for the user.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="user"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentException">If <paramref name="user"/>.<see cref="net.openstack.Core.Domain.User.Id"/> is <see langword="null"/> or empty.</exception>
        public UpdateUserRequest(User user)
        {
            if (user == null)
                throw new ArgumentNullException("user");
            if (string.IsNullOrEmpty(user.Id))
                throw new ArgumentException("user.Id cannot be null or empty");

            User = user;
        }
        public static void Init(TestContext context)
        {
            _testIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestIdentity);
            _testAdminIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestAdminIdentity);
            _testDomainIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestDomainIdentity);

            var provider = BuildProvider();

            _userDetails = provider.GetUserByName(_testIdentity.Username, _testIdentity);
            _adminUserDetails = provider.GetUserByName(_testAdminIdentity.Username, _testAdminIdentity);
        }
        public static void Init(TestContext context)
        {
            _testIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestIdentity);
            _testAdminIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestAdminIdentity);

            _newAPIKey = Guid.NewGuid().ToString();
            _adminNewAPIKey = Guid.NewGuid().ToString();

            var provider = BuildProvider();

            _userDetails = provider.GetUserByName(_testIdentity, _testIdentity.Username);
            _adminUserDetails = provider.GetUserByName(_testAdminIdentity, _testAdminIdentity.Username);
        }
 public bool SetUserPassword(CloudIdentity identity, User user, string password)
 {
     var provider = GetProvider(identity);
     return provider.SetUserPassword(identity, user, password);
 }
 public User UpdateUser(CloudIdentity identity, User user)
 {
     var provider = GetProvider(identity);
     return provider.UpdateUser(identity, user);
 }
 public UserCredential UpdateUserCredentials(CloudIdentity identity, User user, string apiKey)
 {
     var provider = GetProvider(identity);
     return provider.UpdateUserCredentials(identity, user, apiKey);
 }
 public User AddUser(CloudIdentity identity, User user)
 {
     var provider = GetProvider(identity);
     return provider.AddUser(identity, user);
 }
        public void Should_Update_NewUser_Username_And_Email_When_Requesting_As_Self()
        {
            IIdentityProvider provider = new CloudIdentityProvider(new RackspaceCloudIdentity { Username = _testUser.Username, Password = _newTestUserPassword });

            var user = new User
            {
                Id = _testUser.Id,
                Username = "******",
                Email = "*****@*****.**",
                Enabled = true,
            };
            var updatedUser = provider.UpdateUser(user);

            Assert.IsNotNull(updatedUser);
            Assert.AreEqual("openstacknettestuser42", updatedUser.Username);
            Assert.AreEqual("*****@*****.**", updatedUser.Email);
            Assert.AreEqual(true, updatedUser.Enabled);
        }
        public void Should_Update_NewUser_Username_And_Email_And_Default_Region_When_Requesting_As_User_Admin()
        {
            IIdentityProvider provider = new CloudIdentityProvider(_testIdentity);

            var user = new User
            {
                Id = _testUser.Id,
                Username = "******",
                Email = "*****@*****.**",
                Enabled = true,
                DefaultRegion = "DFW"
            };
            var updatedUser = provider.UpdateUser(user);

            Assert.IsNotNull(updatedUser);
            Assert.AreEqual("openstacknettestuser32", updatedUser.Username);
            Assert.AreEqual("*****@*****.**", updatedUser.Email);
            Assert.AreEqual(true, updatedUser.Enabled);
            Assert.AreEqual("DFW", updatedUser.DefaultRegion);
        }
        public void Should_Retrieve_New_User_2_As_User_Admin()
        {
            IIdentityProvider provider = new CloudIdentityProvider(_testAdminIdentity);

            _testUser = provider.GetUserByName("openstacknettestuser2");

            Assert.IsNotNull(_testUser);
            Assert.AreEqual("openstacknettestuser2", _testUser.Username);
            Assert.AreEqual("*****@*****.**", _testUser.Email);
            Assert.AreEqual(true, _testUser.Enabled);
        }
        public void Should_List_Details_Of_Self_When_Retrieving_User_By_Id_With_Admin_Account()
        {
            IIdentityProvider serviceProvider = new CloudIdentityProvider(_testAdminIdentity);

            _adminUserDetails = serviceProvider.GetUser(_adminUserDetails.Id);

            Assert.IsNotNull(_adminUserDetails);
            Assert.AreEqual(_testAdminIdentity.Username, _adminUserDetails.Username);
        }
 public User UpdateUser(User user, CloudIdentity identity)
 {
     var provider = GetProvider(identity);
     return provider.UpdateUser(user, identity: identity);
 }
 public bool SetUserPassword(User user, string password, CloudIdentity identity)
 {
     var provider = GetProvider(identity);
     return provider.SetUserPassword(user, password, identity: identity);
 }
Beispiel #14
0
        public void Should_Update_NewUser_Username_And_Email_When_Requesting_As_User_Admin()
        {
            IIdentityProvider provider = new IdentityProvider(_testIdentity);

            var user = new User
                           {
                               Id = _testUser.Id,
                               Username = "******",
                               Email = "*****@*****.**",
                               Enabled = true
                           };
            var updatedUser = provider.UpdateUser(user);

            Assert.IsNotNull(updatedUser);
            Assert.AreEqual("openstacknettestuser12", updatedUser.Username);
            Assert.AreEqual("*****@*****.**", updatedUser.Email);
            Assert.AreEqual(true, updatedUser.Enabled);
            Assert.IsTrue(string.IsNullOrWhiteSpace(updatedUser.DefaultRegion));
        }
Beispiel #15
0
        public void Should_List_Details_Of_Self_When_Retrieving_User_By_Name_With_Non_Admin_Account()
        {
            IIdentityProvider serviceProvider = new IdentityProvider(_testIdentity);

            _userDetails = serviceProvider.GetUserByName(_testIdentity.Username);

            Assert.IsNotNull(_userDetails);
            Assert.AreEqual(_testIdentity.Username, _userDetails.Username);
        }