Esempio n. 1
0
 public void IsOrganizationAdminReturnsTrueWhenUserIsOrganizationAdmin()
 {
     var principal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(AllReady.Security.ClaimTypes.UserType, "OrgAdmin") }));
     Assert.False(principal.IsOrganizationAdmin());
 }
Esempio n. 2
0
 public void IsOrganizationAdminReturnsFalseWhenUserDoesNotHaveOrganizationId()
 {
     var principal = new ClaimsPrincipal();
     Assert.False(principal.IsOrganizationAdmin());
 }
Esempio n. 3
0
        public void WhenOrganizationIdIsSetNonOrganizationAdminShouldNotBeAdminOfOrganization()
        {
            var principal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(AllReady.Security.ClaimTypes.Organization, "2") }));

            Assert.False(principal.IsOrganizationAdmin(2));
        }
Esempio n. 4
0
        public void WhenOrganizationIdIsSetOrganizationAdminShouldBeAdminOfOrganization()
        {
            var principal = new ClaimsPrincipal(new ClaimsIdentity(new[]
            {
                new Claim(AllReady.Security.ClaimTypes.UserType, "OrgAdmin"),
                new Claim(AllReady.Security.ClaimTypes.Organization, "2")
            }));

            Assert.True(principal.IsOrganizationAdmin(2));
        }
Esempio n. 5
0
        public void WhenOrganizationIdIsNotSetOrganizationAdminShouldNotBeAdminOfOrganization()
        {
            var principal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(AllReady.Security.ClaimTypes.UserType, "OrgAdmin") }));

            Assert.False(principal.IsOrganizationAdmin(1));
        }
Esempio n. 6
0
        public void SiteAdminShouldBeAdminOfAnyOrganizationId()
        {
            var principal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(AllReady.Security.ClaimTypes.UserType, "SiteAdmin") }));

            Assert.True(principal.IsOrganizationAdmin(12));
        }