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" ); }
/// <summary> /// Returns true if two grants are equal. The grantee and permissions must be the same. /// </summary> /// <param name="obj">The object to test for equality</param> /// <returns>True if the grants are equal</returns> public override bool Equals(object obj) { Grant g2 = (Grant)obj; return(g2.grantee.Equals(grantee) && g2.permission.Equals(permission)); }