Пример #1
0
def revokeAuthorization(uid, action):
    uid = int(uid)
    if action == "*":
        for action_id in polkit.action_list():
            try:
                polkit.auth_revoke(uid, action_id)
            except:
                return False
    else:
        try:
            polkit.auth_revoke(uid, action)
        except:
            return False
    return True
Пример #2
0
def revokeAuthorization(uid, action):
    uid = int(uid)
    if action == "*":
        for action_id in polkit.action_list():
            try:
                polkit.auth_revoke(uid, action_id)
            except:
                return False
    else:
        try:
            polkit.auth_revoke(uid, action)
        except:
            return False
    return True
Пример #3
0
def grantAuthorization(uid, action):
    uid = int(uid)
    if action == "*":
        for action_id in polkit.action_list():
            try:
                polkit.auth_revoke(uid, action_id)
                polkit.auth_add(action_id, polkit.SCOPE_ALWAYS, uid)
            except:
                return False
    else:
        try:
            polkit.auth_revoke(uid, action)
            polkit.auth_add(action, polkit.SCOPE_ALWAYS, uid)
        except:
            return False
    return True
Пример #4
0
def grantAuthorization(uid, action):
    uid = int(uid)
    if action == "*":
        for action_id in polkit.action_list():
            try:
                polkit.auth_revoke(uid, action_id)
                polkit.auth_add(action_id, polkit.SCOPE_ALWAYS, uid)
            except:
                return False
    else:
        try:
            polkit.auth_revoke(uid, action)
            polkit.auth_add(action, polkit.SCOPE_ALWAYS, uid)
        except:
            return False
    return True
Пример #5
0
    def buildPolicies(self):
        self.actionItems = {}
        self._vendors = []

        categories = {
            "tr.org.pardus.comar.user.manager": (i18n("User/group operations"),
                                                 "system-users"),
            "tr.org.pardus.comar.system.manager|org.kde.fontinst":
            (i18n("Package operations"), "applications-other"),
            "tr.org.pardus.comar.system.service": (i18n("Service operations"),
                                                   "services"),
            "tr.org.pardus.comar.time|org.kde.kcontrol.kcmclock":
            (i18n("Date/time operations"), "clock"),
            "tr.org.pardus.comar.boot.modules|org.kde.ksysguard":
            (i18n("Kernel/Process operations"), "utilities-terminal"),
            "tr.org.pardus.comar.boot.loader": (i18n("Bootloader settings"),
                                                "media-floppy"),
            "org.kde.kcontrol.kcmpanda": (i18n("Screen settings"),
                                          "video-display"),
            "org.kde.kcontrol.kcmlocale": (i18n("Locale settings"),
                                           "preferences-desktop-locale"),
            "tr.org.pardus.comar.net.filter|tr.org.pardus.comar.net.share|org.freedesktop.network-manager-settings|org.freedesktop.NetworkManager":
            (i18n("Network settings"), "networkmanager"),
            "org.kde.kcontrol.kcmkdm": (i18n("Login Manager settings"),
                                        "preferences-system-login"),
            "org.kde.kcontrol.kcmkeyboard": (i18n("Keyboard settings"),
                                             "input-keyboard")
        }

        # do not show policies require policy type yes or no, only the ones require auth_* type
        allActions = filter(
            lambda x: polkit.action_info(x)['policy_active'].startswith("auth_"
                                                                        ),
            polkit.action_list())
        for _category in categories.keys():
            parent_item = QtGui.QTreeWidgetItem(self.treeAuthorizations)
            parent_item.setIcon(0, kdeui.KIcon(categories[_category][1]))
            parent_item.setText(0, unicode(categories[_category][0]))
            for category in _category.split('|'):
                catactions = filter(lambda x: x.startswith(category),
                                    allActions)
                for action_id in catactions:
                    info = polkit.action_info(action_id)
                    item = PolicyItem(parent_item,
                                      unicode(info["description"]), action_id)
                    self.actionItems[action_id] = item
Пример #6
0
    def buildPolicies(self):
        self.actionItems = {}
        self._vendors = []

        categories = {
            "tr.org.pardus.comar.user.manager":
            (i18n("User/group operations"), "system-users"),
            "tr.org.pardus.comar.system.manager":
            (i18n("Package operations"), "applications-other"),
            "tr.org.pardus.comar.system.service":
            (i18n("Service operations"), "services"),
            "tr.org.pardus.comar.time": (i18n("Date/time operations"),
                                         "clock"),
            "tr.org.pardus.comar.boot.modules":
            (i18n("Kernel/Process operations"), "utilities-terminal"),
            "tr.org.pardus.comar.boot.loader": (i18n("Bootloader settings"),
                                                "media-floppy")
        }

        # do not show policies require policy type yes or no, only the ones require auth_* type
        allActions = filter(
            lambda x: polkit.action_info(x)['policy_active'].startswith("auth_"
                                                                        ),
            polkit.action_list())
        for _category in categories.keys():
            parent_item = QtGui.QTreeWidgetItem(self.treeAuthorizations)
            parent_item.setIcon(0, KIcon(categories[_category][1]))
            parent_item.setText(0, unicode(categories[_category][0]))
            for category in _category.split('|'):
                catactions = filter(lambda x: x.startswith(category),
                                    allActions)
                for action_id in catactions:
                    info = polkit.action_info(action_id)
                    item = PolicyItem(parent_item,
                                      unicode(info["description"]), action_id)
                    self.actionItems[action_id] = item
Пример #7
0
    def buildPolicies(self):
        self.actionItems = {}
        self._vendors = []

        categories = {"tr.org.pardus.comar.user.manager": (i18n("User/group operations"), "system-users"),
                      "tr.org.pardus.comar.system.manager|org.kde.fontinst": (i18n("Package operations"), "applications-other"),
                      "tr.org.pardus.comar.system.service": (i18n("Service operations"), "services"),
                      "tr.org.pardus.comar.time|org.kde.kcontrol.kcmclock": (i18n("Date/time operations"), "clock"),
                      "tr.org.pardus.comar.boot.modules|org.kde.ksysguard": (i18n("Kernel/Process operations"), "utilities-terminal"),
                      "tr.org.pardus.comar.boot.loader": (i18n("Bootloader settings"), "media-floppy"),
                      "org.kde.kcontrol.kcmpanda": (i18n("Screen settings"), "video-display"),
                      "org.kde.kcontrol.kcmlocale": (i18n("Locale settings"), "preferences-desktop-locale"),
                      "tr.org.pardus.comar.net.filter|tr.org.pardus.comar.net.share|org.freedesktop.network-manager-settings|org.freedesktop.NetworkManager": (i18n("Network settings"), "networkmanager"),
                      "org.kde.kcontrol.kcmkdm": (i18n("Login Manager settings"), "preferences-system-login"),
                      "org.kde.kcontrol.kcmkeyboard": (i18n("Keyboard settings"), "input-keyboard")}

        # do not show policies require policy type yes or no, only the ones require auth_* type
        allActions = filter(lambda x: polkit.action_info(x)['policy_active'].startswith("auth_"),polkit.action_list())
        for _category in categories.keys():
            parent_item = QtGui.QTreeWidgetItem(self.treeAuthorizations)
            parent_item.setIcon(0, kdeui.KIcon(categories[_category][1]))
            parent_item.setText(0, unicode(categories[_category][0]))
            for category in _category.split('|'):
                catactions = filter(lambda x: x.startswith(category), allActions)
                for action_id in catactions:
                    info = polkit.action_info(action_id)
                    item = PolicyItem(parent_item, unicode(info["description"]), action_id)
                    self.actionItems[action_id] = item
Пример #8
0
    def fillAuths(self):
        #do not show policies require policy type yes or no, only the ones require auth_* type
        allActions = filter(lambda x: polkit.action_info(x)['policy_active'].startswith("auth_"),polkit.action_list())

        for category in categories.keys():
            catitem = KListViewItem(self.policyview, i18n(categories[category][0]))
            catitem.setPixmap(0, getIcon(categories[category][1]))
            catactions = filter(lambda x: x.startswith(category), allActions)
            for cataction in catactions:
                actioninfo = polkit.action_info(cataction)
                actionitem = ActionItem(catitem, cataction, unicode(actioninfo['description']), actioninfo['policy_active'])
Пример #9
0
    def buildPolicies(self):
        self.actionItems = {}
        self._vendors = []

        categories = {"tr.org.pardus.comar.user.manager": (i18n("User/group operations"), "system-users"),
                      "tr.org.pardus.comar.system.manager": (i18n("Package operations"), "applications-other"),
                      "tr.org.pardus.comar.system.service": (i18n("Service operations"), "services"),
                      "tr.org.pardus.comar.time": (i18n("Date/time operations"), "clock"),
                      "tr.org.pardus.comar.boot.modules": (i18n("Kernel/Process operations"), "utilities-terminal"),
                      "tr.org.pardus.comar.boot.loader": (i18n("Bootloader settings"), "media-floppy")}

        # do not show policies require policy type yes or no, only the ones require auth_* type
        allActions = filter(lambda x: polkit.action_info(x)['policy_active'].startswith("auth_"),polkit.action_list())
        for _category in categories.keys():
            parent_item = QtWidgets.QTreeWidgetItem(self.treeAuthorizations)
            parent_item.setIcon(0,KIcon(categories[_category][1]))
            parent_item.setText(0, unicode(categories[_category][0]))
            for category in _category.split('|'):
                catactions = filter(lambda x: x.startswith(category), allActions)
                for action_id in catactions:
                    info = polkit.action_info(action_id)
                    item = PolicyItem(parent_item, unicode(info["description"]), action_id)
                    self.actionItems[action_id] = item