summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-08-22 19:36:09 +0200
committerRuben Pollan <meskio@sindominio.net>2017-09-15 23:40:04 +0200
commitbf7920abcceb0651ab536b3a7268cc87b886469e (patch)
treecac99e5f1e8c3a55122bf7f000207abacf10707f
parent205571493d2d71d328b1762953db5d4271db0acb (diff)
[refactor] remove unused 'is_missing_policy_permissions'
-rw-r--r--src/leap/bitmask/vpn/privilege.py56
1 files changed, 1 insertions, 55 deletions
diff --git a/src/leap/bitmask/vpn/privilege.py b/src/leap/bitmask/vpn/privilege.py
index beb843e8..54065a81 100644
--- a/src/leap/bitmask/vpn/privilege.py
+++ b/src/leap/bitmask/vpn/privilege.py
@@ -23,12 +23,9 @@ are operative under this client run.
import commands
import os
import subprocess
-import platform
import psutil
import time
-from abc import ABCMeta, abstractmethod
-
from twisted.logger import Logger
from twisted.python.procutils import which
@@ -79,46 +76,7 @@ class NoPkexecAvailable(Exception):
message = 'Could not find pkexec in the system'
-# TODO rename to privileged_runner or something like that
-def is_missing_policy_permissions():
- """
- Returns True if we do not have implemented a policy checker for this
- platform, or if the policy checker exists but it cannot find the
- appropriate policy mechanisms in place.
-
- :rtype: bool
- """
- _system = platform.system()
- platform_checker = _system + "PolicyChecker"
- policy_checker = globals().get(platform_checker, None)
- if not policy_checker:
- # it is true that we miss permission to escalate
- # privileges without asking for password each time.
- log.debug('we could not find a policy checker implementation '
- 'for %s' % (_system,))
- return True
- return policy_checker().is_missing_policy_permissions()
-
-
-class PolicyChecker:
- """
- Abstract PolicyChecker class
- """
-
- __metaclass__ = ABCMeta
-
- @abstractmethod
- def is_missing_policy_permissions(self):
- """
- Returns True if we could not find any policy mechanisms that
- are defined to be in used for this particular platform.
-
- :rtype: bool
- """
- return True
-
-
-class LinuxPolicyChecker(PolicyChecker):
+class LinuxPolicyChecker(object):
"""
PolicyChecker for Linux
"""
@@ -138,18 +96,6 @@ class LinuxPolicyChecker(PolicyChecker):
return (self.LINUX_POLKIT_FILE_BUNDLE if STANDALONE
else self.LINUX_POLKIT_FILE)
- def is_missing_policy_permissions(self):
- # FIXME this name is quite confusing, it does not have anything to do
- # with file permissions.
- """
- Returns True if we could not find the appropriate policykit file
- in place
-
- :rtype: bool
- """
- path = self.get_polkit_path()
- return not os.path.isfile(path)
-
@classmethod
def maybe_pkexec(self):
"""