Ejemplo n.º 1
0
        public void PermissionQuery_GetRelatedItems_AllowedOrDenied()
        {
            var content = GetContent("RAX");
            var perms   = new[] { PermissionType.Custom01 };
            var result  = PermissionQuery.GetRelatedItems(content, PermissionLevel.AllowedOrDenied, true, _identities["U1"], perms);
            var actual  = String.Join(", ", result.Select(c => c.Path.Substring(28).Replace("/", "")));

            Assert.AreEqual("RAXC, RAXCC", actual);

            content = GetContent("RAX");
            perms   = new[] { PermissionType.Custom02 };
            result  = PermissionQuery.GetRelatedItems(content, PermissionLevel.AllowedOrDenied, true, _identities["U1"], perms);
            actual  = String.Join(", ", result.Select(c => c.Path.Substring(28).Replace("/", "")));
            Assert.AreEqual("RAXB", actual);

            content = GetContent("RAX");
            perms   = new[] { PermissionType.Custom03 };
            result  = PermissionQuery.GetRelatedItems(content, PermissionLevel.AllowedOrDenied, true, _identities["U1"], perms);
            actual  = String.Join(", ", result.Select(c => c.Path.Substring(28).Replace("/", "")));
            Assert.AreEqual("RAXACA, RAXBBC", actual);

            content = GetContent("RAX");
            perms   = new[] { PermissionType.Custom01, PermissionType.Custom02, PermissionType.Custom03 };
            result  = PermissionQuery.GetRelatedItems(content, PermissionLevel.AllowedOrDenied, true, _identities["U1"], perms);
            actual  = String.Join(", ", result.Select(c => c.Path.Substring(28).Replace("/", "")));
            Assert.AreEqual("RAXACA, RAXB, RAXBBC, RAXC, RAXCC", actual);

            content = GetContent("RAX");
            perms   = new[] { PermissionType.Custom01, PermissionType.Custom02, PermissionType.Custom03 };
            result  = PermissionQuery.GetRelatedItems(content, PermissionLevel.AllowedOrDenied, true, _identities["U3"], perms);
            actual  = String.Join(", ", result.Select(c => c.Path.Substring(28).Replace("/", "")));
            Assert.AreEqual("RAXA, RAXAA, RAXC", actual);
        }
Ejemplo n.º 2
0
        public void PermissionQuery_GetRelatedItems_Denied()
        {
            var content = GetContent("RAX");
            var perms   = new[] { PermissionType.Custom01 };
            var result  = PermissionQuery.GetRelatedItems(content, PermissionLevel.Denied, true, _identities["U3"], perms);
            var actual  = String.Join(", ", result.Select(c => c.Path.Substring(28).Replace("/", "")));

            Assert.AreEqual("RAXA", actual);
        }
Ejemplo n.º 3
0
        public void PermissionQuery_GetRelatedItems_AboveBreakedNoExplicit()
        {
            var content = GetContent("RBA");
            var perms   = new[] { _permissions["P1"] };

            var result = PermissionQuery.GetRelatedItems(content, PermissionLevel.AllowedOrDenied, true, _identities["U1"], perms);
            var actual = String.Join(", ", result.Select(c => c.Path.Substring(28).Replace("/", "")));

            Assert.AreEqual("RBAA, RBAB, RBAC, RBAD", actual);

            result = PermissionQuery.GetRelatedItems(content, PermissionLevel.AllowedOrDenied, true, _identities["U2"], perms);
            actual = String.Join(", ", result.Select(c => c.Path.Substring(28).Replace("/", "")));
            Assert.AreEqual("RBAA, RBAB", actual);
        }