Ejemplo n.º 1
0
        public void TestDisableEnableUserAccount()
        {
            // Create a user and disable it.

            var member = _memberAccountsCommand.CreateTestMember(0);

            Assert.IsTrue(member.IsEnabled);

            var adminId = Guid.NewGuid();

            _userAccountsCommand.DisableUserAccount(member, adminId);

            member = _membersQuery.GetMember(member.Id);
            Assert.IsFalse(member.IsEnabled);

            // Check that the user event was logged.

            AssertDisablement(adminId, member.Id);

            // Enable the user.

            _userAccountsCommand.EnableUserAccount(member, adminId);
            member = _membersQuery.GetMember(member.Id);
            Assert.IsTrue(member.IsEnabled);

            // Check that the user event was logged.

            AssertEnablement(adminId, member.Id);
        }
Ejemplo n.º 2
0
        public void TestDisabledUser()
        {
            var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));

            _userAccountsCommand.DisableUserAccount(employer, Guid.NewGuid());
            AssertJsonError(LogIn(HttpStatusCode.Forbidden, employer.GetLoginId(), employer.GetPassword()), null, "102", "The user is disabled.");
        }
Ejemplo n.º 3
0
        public void TestEnabled()
        {
            var employer = _employersCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));

            _userAccountsCommand.EnableUserAccount(employer, Guid.NewGuid());
            _userAccountsCommand.ActivateUserAccount(employer, Guid.NewGuid());

            employer = _employersQuery.GetEmployer(employer.Id);
            Assert.IsTrue(employer.IsEnabled);
            Assert.IsTrue(employer.IsActivated);
            Assert.IsTrue(_userAccountsQuery.IsEnabled(employer.Id));
            Assert.IsTrue(_userAccountsQuery.IsActive(employer.Id));

            // Disable.

            _userAccountsCommand.DisableUserAccount(employer, Guid.NewGuid());

            employer = _employersQuery.GetEmployer(employer.Id);
            Assert.IsFalse(employer.IsEnabled);
            Assert.IsTrue(employer.IsActivated);
            Assert.IsFalse(_userAccountsQuery.IsEnabled(employer.Id));
            Assert.IsFalse(_userAccountsQuery.IsActive(employer.Id));

            // Enable.

            _userAccountsCommand.EnableUserAccount(employer, Guid.NewGuid());

            employer = _employersQuery.GetEmployer(employer.Id);
            Assert.IsTrue(employer.IsEnabled);
            Assert.IsTrue(employer.IsActivated);
            Assert.IsTrue(_userAccountsQuery.IsEnabled(employer.Id));
            Assert.IsTrue(_userAccountsQuery.IsActive(employer.Id));
        }
Ejemplo n.º 4
0
        public void TestEnabled()
        {
            var member = _membersCommand.CreateTestMember(0);

            _userAccountsCommand.EnableUserAccount(member, Guid.NewGuid());
            _userAccountsCommand.ActivateUserAccount(member, Guid.NewGuid());

            member = _membersQuery.GetMember(member.Id);
            Assert.IsTrue(member.IsEnabled);
            Assert.IsTrue(member.IsActivated);
            Assert.IsTrue(_userAccountsQuery.IsEnabled(member.Id));
            Assert.IsTrue(_userAccountsQuery.IsActive(member.Id));

            // Disable.

            _userAccountsCommand.DisableUserAccount(member, Guid.NewGuid());

            member = _membersQuery.GetMember(member.Id);
            Assert.IsFalse(member.IsEnabled);
            Assert.IsTrue(member.IsActivated);
            Assert.IsFalse(_userAccountsQuery.IsEnabled(member.Id));
            Assert.IsFalse(_userAccountsQuery.IsActive(member.Id));

            // Enable.

            _userAccountsCommand.EnableUserAccount(member, Guid.NewGuid());

            member = _membersQuery.GetMember(member.Id);
            Assert.IsTrue(member.IsEnabled);
            Assert.IsTrue(member.IsActivated);
            Assert.IsTrue(_userAccountsQuery.IsEnabled(member.Id));
            Assert.IsTrue(_userAccountsQuery.IsActive(member.Id));
        }
Ejemplo n.º 5
0
        public void TestDisabled()
        {
            var member = CreateMember(0);

            _userAccountsCommand.DisableUserAccount(member, Guid.NewGuid());

            TestCandidateUrls(member);
        }
Ejemplo n.º 6
0
        public void TestDisabledMember()
        {
            // Create the member.

            var member = _memberAccountsCommand.CreateTestMember(0);

            _userAccountsCommand.DisableUserAccount(member, Guid.NewGuid());

            // Log in.

            AssertNotLoggedIn();
            AssertJsonError(ApiLogIn(member), null, "102", "The user is disabled.");

            // Check not logged in.

            AssertNotLoggedIn();
        }
Ejemplo n.º 7
0
        public ActionResult Disable(Guid id)
        {
            var administrator = _administratorsQuery.GetAdministrator(id);

            if (administrator == null)
            {
                return(NotFound("administrator", "id", id));
            }

            _userAccountsCommand.DisableUserAccount(administrator, User.Id().Value);
            return(RedirectToRoute(AdministratorsRoutes.Edit, new { id }));
        }
Ejemplo n.º 8
0
        public ActionResult Disable(Guid id)
        {
            var employer = _employersQuery.GetEmployer(id);

            if (employer == null)
            {
                return(NotFound("employer", "id", id));
            }

            _userAccountsCommand.DisableUserAccount(employer, User.Id().Value);
            return(RedirectToRoute(EmployersRoutes.Edit, new { id }));
        }
Ejemplo n.º 9
0
        public ActionResult Disable(Guid id)
        {
            var custodian = _custodiansQuery.GetCustodian(id);

            if (custodian == null)
            {
                return(NotFound("custodian", "id", id));
            }

            _userAccountsCommand.DisableUserAccount(custodian, User.Id().Value);
            return(RedirectToRoute(CustodiansRoutes.Edit, new { id }));
        }
Ejemplo n.º 10
0
        public void TestDisabledEmployer()
        {
            var integratorUser = CreateIntegratorUser(0);
            var employer       = CreateEmployer(0);

            // Disable the employer.

            _userAccountsCommand.DisableUserAccount(employer, Guid.NewGuid());

            // Submit a new job ad.

            var jobAd1 = CreateJobAd(1);

            PostJobAdsFailure(integratorUser, employer, true, new[] { jobAd1 }, "Job poster user '" + employer.GetLoginId() + "' is disabled.");
        }
Ejemplo n.º 11
0
        public void TestDisabledMember()
        {
            // Create the member.

            var member = _memberAccountsCommand.CreateTestMember(0);

            _userAccountsCommand.DisableUserAccount(member, Guid.NewGuid());

            // Assert that the user is not already logged in.

            GetLoginUrl();
            AssertPageDoesNotContain(member.FullName);

            // Log in.

            SubmitLogIn(member);
            AssertPath(_contactUsUrl);

            // Check not logged in.

            GetLoginUrl();
            AssertLoginUrl();
            AssertPageDoesNotContain(member.FullName);
        }
Ejemplo n.º 12
0
        public void TestDisabledProfile()
        {
            var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));

            _userAccountsCommand.DisableUserAccount(employer, Guid.NewGuid());

            var profile = new LinkedInProfile
            {
                Id     = LinkedInId,
                UserId = employer.Id,
            };

            _linkedInCommand.UpdateProfile(profile);

            var result = _linkedInAuthenticationCommand.AuthenticateUser(LinkedInId);

            Assert.AreEqual(AuthenticationStatus.Disabled, result.Status);
            Assert.AreEqual(employer.Id, result.User.Id);
        }
 private bool DisableEmployer(IEmployer employer)
 {
     _userAccountsCommand.DisableUserAccount(employer, Guid.NewGuid());
     return(false);
 }