
    J+g                     ,    d Z ddlZdZdad Zd Zd ZdS )z
scripts/test.py
Script used for in-testing functions
Author: Vojtech Pokorny, vojtech.pokorny@prestonet.cz
Date (last edit): 6.2.2025
Note:
    Nz3/var/www/api/scripts/prestonet-webhooks-config.jsonc                     t           z	 t          t          d          5 } t          j        |           a ddd           n# 1 swxY w Y   n7# t
          t          j        f$ r}t          d|            i a Y d}~nd}~ww xY wt           S )zQ
	Load the JSON configuration file.
	Returns the configuration as a dictionary.
	NrzError loading config: )_configopenCONFIG_FILEjsonloadIOErrorJSONDecodeErrorprint)fes     */var/www/api/scripts/prestonet_webhooks.pyload_configr      s     O[# !illG              
4'	(   	%!	%	%&&&777777 	s7   A ?A AA AA A?!A::A?c                  J    t                      } |                     dg           S )z;
	Returns the list of admin users from the configuration.
	admins)r   get)configs    r   get_admin_listr      s!     --

8R       c                     t                      }|                    di           }g }|                                D ]\  }}| |v r|                    |           |S )z
	Returns a list of all groups that the given user (email) is a member of.
	:param user_email: User's email address.
	:return: List of group names.
	groups)r   r   itemsappend)
user_emailr   r   user_groups
group_nameemailss         r   get_user_group_listr   $   si     --
**Xr
"
" "<<>> " "Z6j!!!r   )__doc__r   r   r   r   r   r    r   r   <module>r"      s[     C
  ! ! !    r   