mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-11-04 04:29:13 +00:00 
			
		
		
		
	Check if user is bot before updateOrCreate bot user (#10178)
This commit is contained in:
		
							parent
							
								
									2a99114c94
								
							
						
					
					
						commit
						fc78d03cc4
					
				@ -1138,7 +1138,9 @@ public class UserResource extends EntityResource<User, UserRepository> {
 | 
			
		||||
    String botName = create.getBotName();
 | 
			
		||||
    EntityInterface bot = retrieveBot(botName);
 | 
			
		||||
    // check if the bot user exists
 | 
			
		||||
    if (!botHasRelationshipWithUser(bot, original)
 | 
			
		||||
    if (original != null && (original.getIsBot() == null || Boolean.FALSE.equals(original.getIsBot()))) {
 | 
			
		||||
      throw new IllegalArgumentException(String.format("User [%s] already exists.", original.getName()));
 | 
			
		||||
    } else if (!botHasRelationshipWithUser(bot, original)
 | 
			
		||||
        && original != null
 | 
			
		||||
        && userHasRelationshipWithAnyBot(original, bot)) {
 | 
			
		||||
      // throw an exception if user already has a relationship with a bot
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user