mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-11-04 12:51:23 +00:00 
			
		
		
		
	fix(graphql): Correct ownership check when removing owners (#11154)
Co-authored-by: david-leifker <114954101+david-leifker@users.noreply.github.com> Co-authored-by: Aseem Bansal <asmbansal2@gmail.com>
This commit is contained in:
		
							parent
							
								
									bb8cf97ea3
								
							
						
					
					
						commit
						fa43b67dc6
					
				@ -171,7 +171,7 @@ public class OwnerUtils {
 | 
			
		||||
    if (!owner.getOwner().equals(ownerUrn)) {
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
    if (owner.getTypeUrn() != null) {
 | 
			
		||||
    if (owner.getTypeUrn() != null && ownershipTypeUrn != null) {
 | 
			
		||||
      return owner.getTypeUrn().equals(ownershipTypeUrn);
 | 
			
		||||
    }
 | 
			
		||||
    if (ownershipTypeUrn == null) {
 | 
			
		||||
 | 
			
		||||
@ -59,6 +59,7 @@ public class OwnerUtilsTest {
 | 
			
		||||
    Urn technicalOwnershipTypeUrn = new Urn(TECHNICAL_OWNER_OWNERSHIP_TYPE_URN);
 | 
			
		||||
    Urn businessOwnershipTypeUrn = new Urn(BUSINESS_OWNER_OWNERSHIP_TYPE_URN);
 | 
			
		||||
    Urn ownerUrn1 = new Urn("urn:li:corpuser:foo");
 | 
			
		||||
    Urn ownerUrn2 = new Urn("urn:li:corpuser:bar");
 | 
			
		||||
 | 
			
		||||
    Owner ownerWithTechnicalOwnership = new Owner();
 | 
			
		||||
    ownerWithTechnicalOwnership.setOwner(ownerUrn1);
 | 
			
		||||
@ -72,12 +73,17 @@ public class OwnerUtilsTest {
 | 
			
		||||
    ownerWithoutOwnershipType.setOwner(ownerUrn1);
 | 
			
		||||
    ownerWithoutOwnershipType.setType(OwnershipType.NONE);
 | 
			
		||||
 | 
			
		||||
    Owner owner2WithoutOwnershipType = new Owner();
 | 
			
		||||
    owner2WithoutOwnershipType.setOwner(ownerUrn2);
 | 
			
		||||
    owner2WithoutOwnershipType.setType(OwnershipType.NONE);
 | 
			
		||||
 | 
			
		||||
    assertTrue(
 | 
			
		||||
        OwnerUtils.isOwnerEqual(ownerWithTechnicalOwnership, ownerUrn1, technicalOwnershipTypeUrn));
 | 
			
		||||
    assertFalse(
 | 
			
		||||
        OwnerUtils.isOwnerEqual(ownerWithBusinessOwnership, ownerUrn1, technicalOwnershipTypeUrn));
 | 
			
		||||
    assertFalse(OwnerUtils.isOwnerEqual(ownerWithTechnicalOwnership, ownerUrn1, null));
 | 
			
		||||
    assertTrue(OwnerUtils.isOwnerEqual(ownerWithTechnicalOwnership, ownerUrn1, null));
 | 
			
		||||
    assertTrue(OwnerUtils.isOwnerEqual(ownerWithoutOwnershipType, ownerUrn1, null));
 | 
			
		||||
    assertFalse(OwnerUtils.isOwnerEqual(owner2WithoutOwnershipType, ownerUrn1, null));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public void testIsOwnerEqualWithBothLegacyAndNewType() throws URISyntaxException {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user