mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-14 06:12:19 +03:00
revert default proxy settings in safe and logout
This commit is contained in:
parent
4c9bd198ad
commit
0a8622f2f5
3 changed files with 45 additions and 13 deletions
|
@ -12,19 +12,35 @@ class Logout(AbstractPlugin):
|
|||
self.logger = self.get_logger()
|
||||
self.local_settings_path_suffix = 'policies/managed/'
|
||||
self.local_settings_path = '/etc/opt/chrome/'
|
||||
self.local_settings_proxy_profile = '/etc/profile.d/'
|
||||
self.local_settings_proxy_file = 'liderahenk_chrome_proxy.sh'
|
||||
self.user_js_file = 'liderahenk_browser_chrome_preferences.json'
|
||||
|
||||
self.logger.debug('Parameters were initialized.')
|
||||
self.username = self.get_username()
|
||||
if self.username is None:
|
||||
self.username = self.get_active_user()
|
||||
|
||||
def handle_logout_mode(self):
|
||||
profil_full_path = self.local_settings_path+self.local_settings_path_suffix+self.user_js_file
|
||||
profil_proxy_path = self.local_settings_proxy_profile+self.local_settings_proxy_file
|
||||
if self.is_exist(profil_full_path):
|
||||
self.delete_file(profil_full_path)
|
||||
if self.is_exist(profil_proxy_path):
|
||||
self.delete_file(profil_proxy_path)
|
||||
|
||||
self.default_proxy_settings()
|
||||
|
||||
def default_proxy_settings(self):
|
||||
username = self.get_username()
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http port 8080'".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https host '''".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(username))
|
||||
|
||||
|
||||
def handle_mode(context):
|
||||
|
|
|
@ -80,6 +80,8 @@ class BrowserChrome(AbstractPlugin):
|
|||
proxy_type = "0"
|
||||
proxy_preferences = json.loads(self.data)
|
||||
username = self.get_username()
|
||||
if username is None:
|
||||
username = self.get_active_user()
|
||||
if len(proxy_preferences) > 0:
|
||||
proxy_data = proxy_preferences["proxyListChrome"]
|
||||
for pref in proxy_data:
|
||||
|
@ -117,6 +119,8 @@ class BrowserChrome(AbstractPlugin):
|
|||
|
||||
def default_proxy_settings(self):
|
||||
username = self.get_username()
|
||||
if username is None:
|
||||
username = self.get_active_user()
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(username))
|
||||
|
|
|
@ -8,22 +8,34 @@ class Safe(AbstractPlugin):
|
|||
self.logger = self.get_logger()
|
||||
self.local_settings_path_suffix = 'policies/managed/'
|
||||
self.local_settings_path = '/etc/opt/chrome/'
|
||||
self.local_settings_proxy_profile = '/etc/profile.d/'
|
||||
self.local_settings_proxy_file = 'liderahenk_chrome_proxy.sh'
|
||||
self.user_js_file = 'liderahenk_browser_chrome_preferences.json'
|
||||
self.logger.info('Parameters were initialized.')
|
||||
self.username = self.get_username()
|
||||
if self.username is None:
|
||||
self.username = self.get_active_user()
|
||||
|
||||
def handle_safe_mode(self):
|
||||
|
||||
profil_full_path = self.local_settings_path+self.local_settings_path_suffix+self.user_js_file
|
||||
profil_proxy_path = self.local_settings_proxy_profile+self.local_settings_proxy_file
|
||||
|
||||
if self.is_exist(profil_full_path):
|
||||
self.delete_file(profil_full_path)
|
||||
if self.is_exist(profil_proxy_path):
|
||||
self.delete_file(profil_proxy_path)
|
||||
else:
|
||||
self.logger.debug("{0} user's privilege file not found".format(username))
|
||||
self.logger.debug("{0} user's privilege file not found".format(self.username))
|
||||
self.default_proxy_settings()
|
||||
|
||||
def default_proxy_settings(self):
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy autoconfig-url '''".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy ignore-hosts ['localhost', '127.0.0.0/8']".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy mode 'none''".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy use-same-proxy true'".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp host '''".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.ftp port 0'".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http host '''".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http port 8080'".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https host '''".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.https port 0'".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks host '''".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.socks port 0'".format(self.username))
|
||||
self.execute("su - {0} -c 'gsettings set org.gnome.system.proxy.http use-authentication false'".format(self.username))
|
||||
|
||||
def handle_mode(context):
|
||||
init = Safe(context)
|
||||
|
|
Loading…
Reference in a new issue