mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	api: Add is_remote_server().
This function abstracts the logic to ascertain the source of API auth request.
This commit is contained in:
		@@ -223,3 +223,12 @@ def split_by(array, group_size, filler):
 | 
			
		||||
    """
 | 
			
		||||
    args = [iter(array)] * group_size
 | 
			
		||||
    return list(map(list, zip_longest(*args, fillvalue=filler)))
 | 
			
		||||
 | 
			
		||||
def is_remote_server(identifier):
 | 
			
		||||
    # type: (Text) -> bool
 | 
			
		||||
    """
 | 
			
		||||
    This function can be used to identify the source of API auth
 | 
			
		||||
    request. We can have two types of sources, Remote Zulip Servers
 | 
			
		||||
    and UserProfiles.
 | 
			
		||||
    """
 | 
			
		||||
    return "@" not in identifier
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user