관리-도구
편집 파일: checkers.cpython-311.opt-1.pyc
� IMg� � � � d dl mZ d dlmZ ddlmZ ddlmZ ddlm Z de dee d e fd �Zdde d e de fd �Zdde d e de fd�Zde d e fd�ZdS )� )�List)�deepcopy� )�FeatureDisabledError)�CONFIG_MAPPINGS)�FeatureManagementPerms�feature�permissions�userc � � |�dS t j |� � }|� | � � }||vr$t d� | |�� � � � �dS )a Raise exception if feature is disabled for user :param feature: feature name :param permissions: permissions required :param user: user name :return: None :raises FeatureDisabledError: if user is prohibited from use of the feature Nz.Feature '{name}' is disabled for user '{user}')�namer )r �get_perm�get_featurer �format)r r r �perm�permission_values �`/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/feature_management/checkers.py� check_featurer su � � �|���!�*�4�0�0�D��'�'��0�0���{�*�*�"�<�C�C��4� D� � � � � � +�*� F�sectionc � � |�dS | t vrdS |t | vrdS t | t | | |� � n# t $ r |r� Y dS w xY wdS )at Check if section is allowed to be read or write by user :param feature: feature name :param user: user name :param section: section name to check :param raise_: True to raise exception, otherwise return True or False :return: True if config sections is allowed to user, False otherwise :raises FeatureDisabledError: raised if raise_=True NTF)r r r )r r r �raise_s r �check_configr "