PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /proc/self/root/opt/saltstack/salt/extras-3.10/rads/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : //proc/self/root/opt/saltstack/salt/extras-3.10/rads/reseller.py |
"""backwards compat for rads.reseller""" from cpapis import whmapi1 import rads from . import OUR_RESELLERS from .common import is_cpanel_user # pylint: disable=unused-import from .compat import deprecated APIPA = '169.254.100.100' @deprecated('rads.get_owner') def get_owner(user): """deprecated""" try: return rads.get_owner(user) except rads.CpuserError: return None # mimic old behavior @deprecated('rads.is_child') def is_child(user, *_, **__): """deprecated""" try: return rads.is_child(user) except rads.CpuserError: return None # mimic old behavior @deprecated('cpapis.whmapi1') def all_resellers(): """deprecated""" try: return whmapi1('listresellers')['data']['reseller'] except Exception as exc: print(exc) return None @deprecated('rads.all_cpusers') def all_main_users(res_bool=False, skip=None): """deprecated""" to_skip = {'system', 'root'} to_skip.update(OUR_RESELLERS) if skip: to_skip.update(skip) users = rads.all_cpusers(owners=False) if res_bool: res = all_resellers() return { user: user in res for user in users if user not in to_skip and not is_child(user) } return [x for x in users if x not in to_skip and not is_child(x)] @deprecated('cpapis.whmapi1') def is_reseller(user): """deprecated""" resellers = all_resellers() if resellers is None: return None return user in resellers @deprecated('rads.get_children') def get_children(owner): """deprecated""" return rads.get_children(owner) @deprecated('uapis.whmapi1') def set_owner(user, reseller): """deprecated""" if is_cpanel_user(reseller): if is_cpanel_user(user): try: result = whmapi1( 'modifyacct', args={'user': user, 'owner': reseller} ) return result['metadata']['result'] == 1 except Exception as exc: print(exc) print("Failed to set %s as owner of %s" % (reseller, user)) return False else: print("%s is not a cPanel user" % user) return False else: print("%s is not a cPanel user" % reseller) return False @deprecated('uapis.whmapi1') def set_reseller_acl(user, package): """deprecated""" if is_cpanel_user(user): try: result = whmapi1( 'setacls', args=dict({'reseller': user, 'acllist': package}) ) return result['metadata']['result'] == 1 except Exception as exc: print(exc) print("Failed to set %s as acllist or %s" % (package, user)) return False else: print("%s is not a cPanel user" % user) return False