wo4h dZddlZddlZddlmZmZmZddlmZddl m Z m Z m Z ej eZdZdZedeed ed efd Zedeed ed efd Ze ee eiZd ed eeeegeffdZdS)a This module contains hook, which are called on feature management permission changes. Note that hooks are not executed automatically, developer is responsible to obtain specific hook using get_hook() function and call it. To add hook, create function with name equal to feature name N)AnyCallableOptional) ConfigFile)AVFULL PROACTIVEcdS)NT)_s ]/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/feature_management/hooks.py _hook_stubrs 4cFtjfd}|S)Nch||}|p!tdj|||S)Nz#Hook '%s(%s)' failed for user '%s'.)loggerwarning__name__)uservalueresultcallbacks r wrapz_result_warn..wrapsC$&& &.. 1        r) functoolswraps)rrs` r _result_warnrs8_X Krrrreturncp|sdSt}|dd}t|}|dd}|tkrd}n0|r.|dr|r|drd} |dd|n#t $rYdSwxYwdS)z#Called when 'av' feature is changedTMALWARE_SCANNINGdefault_actionNcleanupnotifyF)rgetr startswithset Exception)rrconfig config_value user_configuser_config_values r antivirusr+$s t \\F::02BCCLT""K#(:r=sh **********777777LLLLLLLLLL  8 $ $   HSM#$> HSM # $       y  *c*h s';T'AB******r