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

            Assert.False(principal.IsOrganizationAdmin(2));
        }
예제 #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));
        }
예제 #5
0
        public void WhenOrganizationIdIsNotSetOrganizationAdminShouldNotBeAdminOfOrganization()
        {
            var principal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(AllReady.Security.ClaimTypes.UserType, "OrgAdmin") }));

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

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