Your IP : 3.147.56.125
�
�cg�� � � � d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZm Z d dl
Zd dlm
Z
mZ d dlmZ d dlmZ d dlmZmZmZmZ dZ G d� d e� � Zd
� Z G d� d� � Z G d
� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� de� � Z! G d� de� � Z" G d� de� � Z# G d� de� � Z$dS )� N)�Tuple�Optional�List)�ClPwd� mysql_lib)�ProcLve)�grep)�cpanel�directadmin�
ispmanager�plesk�0 c � � e Zd ZdZdS )�ConfigDataErrorz�
Should be raised when something went wrong during user's config data
loading/parsing.
Supposed to be used when we want to skip some user with broken
configuration files
N)�__name__�
__module__�__qualname__�__doc__� � �py/clcontrollib.pyr r s � � � � � �� � �Dr r c � � t j � � t j dk rt � � S t j dk rt � � S t j dk rt � � S t j dk rt
� � S t j dk rt � � S t j dk rt � � S t � � S )N�Plesk�cPanel� InterWorx�
ISPManager�DirectAdmin� HostingNG)
�detect� getCPName�CP_NAMEr �Cpanelr r r r �Unknownr r r �detect_panelclassr$ # s� � �
�����
�~�� � ��w�w��
�~��!�!��x�x��
�~��$�$��{�{��
�~��%�%��|�|��
�~��&�&��}�}��
�~��$�$��{�{���9�9�r c �� � e Zd Zd� Zdd�Zd� Zd� Zed� � � Z dd �Z ed
� � � Z
edd�� � Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS )�GeneralPanelc �4 � t � � | _ | j j | _ t j � � | _ | j � � � | j � � � k r t d| j � d| j � d�� � �d | _
d S )NzClass "z" not should be used on panel "�")r �
users_data� __class__r �
class_namer r �current_panel_name�lower�UserWarning�cpapi_plugin)�selfs r �__init__zGeneralPanel.__init__6 s� � ��'�'����.�1���"(�"2�"4�"4����?� � �"�"�d�&=�&C�&C�&E�&E�E�E��d�$�/�d�d�$�Ja�d�d�d�� �
� !����r Fc �4 � | j � � � S )z�
List all admins names in given control panel
:param bool debug: Do produce debug output or don't
:return: list of strings
)r/ �admins�r0 �debugs r �list_adminszGeneralPanel.list_adminsA s � � � �'�'�)�)�)r c �6 � | j � |� � S )z|
Return True if username is in admin names
:param str username: user to check
:return: bool
)r/ �is_admin)r0 �usernames r r8 zGeneralPanel.is_adminI s � � � �)�)�(�3�3�3r c �l � |r1t j � |� d| j j � d�� � d S d S )Nz is not implemented for �
)�sys�stderr�writer* r �r0 r5 �method_names r �_warningzGeneralPanel._warningQ sI � �� b��J����`�`�T�^�E\�`�`�`�a�a�a�a�a� b� br c �J � t j t j d| � �� � d S )NzCL_CONTROLLIB: )�syslog�LOG_WARNING)�msgs r �
_slog_warningzGeneralPanel._slog_warningU s&