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
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'])
def listUserAuthorizations(uid): actions = polkit.auth_list_uid(int(uid)) auths = [] for action in actions: action_info = polkit.action_info(action['action_id']) auths.append((action['action_id'], action['scope'], action_info['description'], action_info['policy_active'], action['negative'])) return auths
def listUserAuthorizationsByCategory(uid, name): actions = polkit.auth_list_uid(int(uid)) auths = [] names = name.split('|') for action in actions: nameExist = False for nm in names: if action['action_id'].startswith(nm): nameExist = True break if nameExist: action_info = polkit.action_info(action['action_id']) auths.append((action['action_id'], action['scope'], action_info['description'], action_info['policy_active'], action['negative'])) return auths
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
def listUserAuthorizations(uid): actions = polkit.auth_list_uid(int(uid)) auths = [] for action in actions: action_info = polkit.action_info(action["action_id"]) auths.append( ( action["action_id"], action["scope"], action_info["description"], action_info["policy_active"], action["negative"], ) ) return auths
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