Example #1
0
        public void test_GroupPermissions()
        {
            MQConnection con = null;

            try {
                con = connectToServer(address, null, null);
                createNewGroup(con, TEST_GROUPS[0]);
                ErrorCode ec;
                for (int x = 7; x >= 0; x--)
                {
                    ec = con.GroupSetPermissions(TEST_GROUPS[0], (x & 0x04) != 0, (x & 0x2) != 0, (x & 0x1) != 0);
                    Assert.IsTrue(ec == ErrorCode.EC_NOERROR, "Failed to set permissions for: " + TEST_GROUPS[0]);
                    ActorPermissions actorPerms = new ActorPermissions();
                    ec = con.GroupGetPermissions(TEST_GROUPS[0], actorPerms);
                    Assert.IsTrue(ec == ErrorCode.EC_NOERROR, "Failed to retrive permissions for: " + TEST_GROUPS[0]);
                    Assert.IsTrue(actorPerms.ModifyQueues == ((x & 0x04) != 0), "Modify queues incorrectly set: " + x);
                    Assert.IsTrue(actorPerms.ModifyUsers == ((x & 0x02) != 0), "Modify users incorrectly set: " + x);
                    Assert.IsTrue(actorPerms.ModifyGroups == ((x & 0x01) != 0), "Modify groups incorrectly set: " + x);
                }
            } finally {
                if (con != null)
                {
                    con.Close();
                }
            }
        }