관리-도구
편집 파일: myimunify_id.cpython-311.opt-1.pyc
� IMg� � �. � d dl Z d dlZd dlmZ d dlmZmZmZ d dlm Z d dl mZ d dlm Z mZ d dlmZ d dlmZ d Z G d � de� � Zded edee fd�Zdee fd�Zdeeef fd�Zdedefd�Zdededefd�Zdedefd�Zdedefd�ZdS )� N)�Path)�Dict�List�Optional)�logger)�instance)� MyImunify�update_users_protection)�HostingPanel)�safe_fileopsz .myimunify_idc � � e Zd ZdZdS )�MyImunifyIdErrorz5Exception representing issues related to MyImunify idN)�__name__� __module__�__qualname__�__doc__� � �[/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/contracts/myimunify_id.pyr r s � � � � � �?�?�?�?r r �user� protection�returnc � � K � t j |�� � \ }}|� � � t | |g|� � � d{V �� t j d||� � t |� � � d{V ��}n# t $ r Y dS w xY w|S )z5Save subscription type to the DB and generate id file�r Nz(Applied setting MyImunify=%s for user %s)r � get_or_create�saver r �info�_get_or_generate_idr )�sinkr r � myimunify�_�myimunify_ids r �add_myimunify_userr# s� � � � � �*��5�5�5�L�I�q� �N�N���� !�$��� � ;� ;�;�;�;�;�;�;�;� �K�:�J��M�M�M��0��6�6�6�6�6�6�6�6����� � � ��t�t����� �s �A4 �4 B�Bc � �N K � g } t � � � � � � d{V ��}t � � � d{V ��}t j � � � 5 t |� � � � � D ]�\ }}t j |�� � \ }}| � |� |i � � � dd� � |||j |� |i � � � dd� � d�� � �� ddd� � n# 1 swxY w Y | S )zP Get a list of MyImunify users, their subscription types and unique ids Nr �email� �locale)r% �usernamer"