Beispiel #1
0
        public void testUpdateObjectAcl() {
            // Create an object with an ACL
            Acl acl = new Acl();
            acl.AddGrant( new Grant( new Grantee( getUid(esu.GetUid()), Grantee.GRANTEE_TYPE.USER ), Permission.FULL_CONTROL ) );
            Grant other = new Grant( Grantee.OTHER, Permission.READ );
            acl.AddGrant( other );
            ObjectId id = this.esu.CreateObject( acl, null, null, null );
            Assert.IsNotNull( id,"null ID returned" );
            cleanup.Add( id );

            // Read back the ACL and make sure it matches
            Acl newacl = this.esu.GetAcl( id );
            Debug.WriteLine( "Comparing " + newacl + " with " + acl );

            Assert.AreEqual( acl, newacl, "ACLs don't match" );
            
            // Change the ACL and update the object.
            acl.RemoveGrant( other );
            Grant o2 = new Grant( Grantee.OTHER, Permission.NONE );
            acl.AddGrant( o2 );
            this.esu.SetAcl( id, acl );
            
            // Read the ACL back and check it
            newacl = this.esu.GetAcl( id );
            Debug.WriteLine( "Comparing " + newacl + " with " + acl );
            Assert.AreEqual( acl, newacl, "ACLs don't match" );
        }