K6h+ dZddlZddlmZmZddlmZddlmZddl m Z m Z ej e ZedZGddZd efd Zedd Zedd ZdS)u  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see . Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see N)ModelSqliteDatabase)FULL)skip_for_im360)find_revisium_dbget_all_domainsc0eZdZUeed<edZdS)dbFeatureManagementPermissionsc*|jd|_dS)Nfeature_management_permissions)ormr )clsmigrators a/opt/imunify360/venv/lib/python3.11/site-packages/imav/migrations/008_subscription_permissions.pyinitzdb.init&s+3< ,, (((N)__name__ __module__ __qualname__r__annotations__ classmethodrrrr r #s;"''''  [   rr returnc,i} t}n4#t$r'}td||cYd}~Sd}~wwxYw|D]8}|dx}|dx} 3|||<9|S)z1 {"user123": False, "user345": True, ..} zFailed to get Plesk domains: %rNownerimav_cleanup_allowed)r Exceptionloggerwarningvaluesget)user_imav_cleanup_perm all_domainse domain_inforrs rget_imav_permission_mapr'-s &%'' &&&8!<<<%%%%%%%&#))++ = =  __W-- -E 6 $/OO4J$K$K K   (<u%% !!s A?AAFc |rdSt}|tddS t}n@#t$r3}tdt |Yd}~dSd}~wwxYw|stddSt|| D]\}} tj |\} } |r t| _ | L#t$r3}td|t |Yd}~d}~wwxYwdS)Nz/No legacy ImunifyAV database found. Skipping...z6Cannot obtain permissions map for migration, Error: %sz*No users to migrate AV cleanup permissions)userzLL M   M1 %#'  ""$$$    NNNA    HHHH  s0A A> (A99A>AD E#)EEc dS)Nr)rr0r1r2s rrollbackr;qsDr)F)__doc__loggingpeeweerr,defence360agent.feature_management.constantsrimav.migration_utils.otherrimav.migration_utils.revisiumrr getLoggerrrrar dictr'r9r;rrrrEs*((((((((======555555KKKKKKKK  8 $ $^D        """""4&&&&R      r