mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-21 18:32:15 +03:00
safe mode for chrome plugin
This commit is contained in:
parent
99533487ff
commit
cc6c820343
2 changed files with 2 additions and 65 deletions
|
@ -1,49 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# Author:Ebru ARSLAN <ebru.arslan@pardus.org.tr>
|
||||
|
||||
from base.plugin.abstract_plugin import AbstractPlugin
|
||||
|
||||
|
||||
class Logout(AbstractPlugin):
|
||||
def __init__(self, context):
|
||||
super(Logout, self).__init__()
|
||||
self.context = context
|
||||
self.logger = self.get_logger()
|
||||
self.local_settings_path_suffix = 'policies/managed/'
|
||||
self.local_settings_path = '/etc/opt/chrome/'
|
||||
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
|
||||
if self.is_exist(profil_full_path):
|
||||
self.delete_file(profil_full_path)
|
||||
|
||||
self.default_proxy_settings()
|
||||
|
||||
def default_proxy_settings(self):
|
||||
username = self.get_username()
|
||||
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != 'none':
|
||||
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):
|
||||
logout = Logout(context)
|
||||
logout.handle_logout_mode()
|
|
@ -10,9 +10,7 @@ class Safe(AbstractPlugin):
|
|||
self.local_settings_path = '/etc/opt/chrome/'
|
||||
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()
|
||||
self.username = self.context.get('username')
|
||||
|
||||
def handle_safe_mode(self):
|
||||
profil_full_path = self.local_settings_path+self.local_settings_path_suffix+self.user_js_file
|
||||
|
@ -23,20 +21,8 @@ class Safe(AbstractPlugin):
|
|||
self.default_proxy_settings()
|
||||
|
||||
def default_proxy_settings(self):
|
||||
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != 'none':
|
||||
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))
|
||||
if (self.execute("su - {0} -c 'gsettings get org.gnome.system.proxy mode'".format(self.username))) != "'none'":
|
||||
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