コード例 #1
0
    def __init__(self, dbname, proxy_client, parent=None):
        ServerFunctionDialog.__init__(self, dbname, proxy_client, parent)

        header = u"%s %s" % (_("Manage Database"), dbname)
        self.setWindowTitle(header)

        header_label = QtGui.QLabel("<b>%s</b>" % header)
        header_label.setAlignment(QtCore.Qt.AlignCenter)

        label = QtGui.QLabel(
            "%s<br /><em>%s</em>" %
            (_('The following remote functions can be called.'),
             _('''Please note - some of these functions
            may take a long time to execute and give little feedback''')))
        label.setWordWrap(True)

        self.insertWidget(header_label)
        self.insertWidget(label)

        for func, desc in self.proxy_client.get_management_functions():
            but = QtGui.QPushButton(desc)
            but.func_name = func
            self.insertWidget(but)
            but.clicked.connect(self.but_clicked)

        advanced_label = QtGui.QLabel("no advanced features available")

        self.add_advanced_widget(advanced_label)

        self.cancel_but.setText(_("Close"))
        self.apply_but.hide()
コード例 #2
0
    def __init__(self, dbname, proxy_client, parent=None):
        ServerFunctionDialog.__init__(self, dbname, proxy_client, parent)

        header = u"%s %s"% (_("Manage Database"), dbname)
        self.setWindowTitle(header)

        header_label = QtGui.QLabel("<b>%s</b>"% header)
        header_label.setAlignment(QtCore.Qt.AlignCenter)

        label = QtGui.QLabel("%s<br /><em>%s</em>"% (
            _('The following remote functions can be called.'),
            _('''Please note - some of these functions
            may take a long time to execute and give little feedback''')
            ))
        label.setWordWrap(True)

        self.insertWidget(header_label)
        self.insertWidget(label)


        for func, desc in self.proxy_client.get_management_functions():
            but = QtGui.QPushButton(desc)
            but.func_name = func
            self.insertWidget(but)
            but.clicked.connect(self.but_clicked)

        advanced_label = QtGui.QLabel("no advanced features available")

        self.add_advanced_widget(advanced_label)

        self.cancel_but.setText(_("Close"))
        self.apply_but.hide()
コード例 #3
0
    def __init__(self, proxy_client, parent=None):
        ServerFunctionDialog.__init__(self, None, proxy_client, parent)

        header = _("Drop Postgres Users")

        self.setWindowTitle(header)

        header_label = QtGui.QLabel("<b>%s</b>" % header)
        header_label.setWordWrap(True)
        header_label.setAlignment(QtCore.Qt.AlignCenter)

        label = QtGui.QLabel(u"<em>%s?</em>" %
                             _("Which user do you wish to remove"))
        label.setWordWrap(True)
        label.setAlignment(QtCore.Qt.AlignCenter)

        self.insertWidget(header_label)
        self.insertWidget(label)

        frame = QtGui.QFrame()
        self.insertWidget(frame)
        self.set_advanced_but_text(_("Help"))
        #self.add_advanced_widget()

        self.privileged_cbs = {}
        self.standard_cbs = {}

        for user in self.proxy_client.get_pg_user_list():
            if user in SUPERUSERS:
                continue
            but = QtGui.QPushButton(user)
            self.insertWidget(but)
            but.clicked.connect(self.but_clicked)

        advanced_label = QtGui.QLabel("no advanced features available")

        self.add_advanced_widget(advanced_label)

        self.cancel_but.setText(_("Close"))
        self.apply_but.hide()
コード例 #4
0
    def __init__(self, proxy_client, parent=None):
        ServerFunctionDialog.__init__(self, None, proxy_client, parent)

        header = _("Drop Postgres Users")

        self.setWindowTitle(header)

        header_label = QtGui.QLabel("<b>%s</b>"% header)
        header_label.setWordWrap(True)
        header_label.setAlignment(QtCore.Qt.AlignCenter)

        label = QtGui.QLabel(u"<em>%s?</em>"%
            _("Which user do you wish to remove"))
        label.setWordWrap(True)
        label.setAlignment(QtCore.Qt.AlignCenter)

        self.insertWidget(header_label)
        self.insertWidget(label)

        frame = QtGui.QFrame()
        self.insertWidget(frame)
        self.set_advanced_but_text(_("Help"))
        #self.add_advanced_widget()

        self.privileged_cbs = {}
        self.standard_cbs = {}

        for user in self.proxy_client.get_pg_user_list():
            if user in SUPERUSERS:
                continue
            but = QtGui.QPushButton(user)
            self.insertWidget(but)
            but.clicked.connect(self.but_clicked)

        advanced_label = QtGui.QLabel("no advanced features available")

        self.add_advanced_widget(advanced_label)

        self.cancel_but.setText(_("Close"))
        self.apply_but.hide()
コード例 #5
0
    def __init__(self, dbname, proxy_client, parent=None):
        ServerFunctionDialog.__init__(self, dbname, proxy_client, parent)

        header = u"%s %s"% (_("Configure Sessions for"), dbname)
        self.setWindowTitle(header)

        header_label = QtGui.QLabel("<b>%s</b>"% header)
        header_label.setAlignment(QtCore.Qt.AlignCenter)

        label = QtGui.QLabel(
            _("please check the following text, then save the file"))
        label.setWordWrap(True)

        self.insertWidget(header_label)
        self.insertWidget(label)

        try:
            f = open(TEMPLATE, "r")
            data = f.read()
            f.close()
        except Exception as exc:
            LOGGER.exception("error opening file")
            data = u"%s<pre>%s</pre>"% (
                _("couldn't open template file"), exc)

        self.text_edit = QtGui.QTextEdit()
        self.text_edit.setWordWrapMode(QtGui.QTextOption.NoWrap)
        self.text_edit.setFontFamily("Courier")
        self.text_edit.setText(data)

        self.insertWidget(self.text_edit)

        advanced_label = QtGui.QLabel("no advanced features available")

        self.add_advanced_widget(advanced_label)

        self.apply_but.setText("Save")
        self.enableApply()
コード例 #6
0
    def __init__(self, dbname, proxy_client, parent=None):
        ServerFunctionDialog.__init__(self, dbname, proxy_client, parent)

        header = u"%s %s" % (_("Configure Sessions for"), dbname)
        self.setWindowTitle(header)

        header_label = QtGui.QLabel("<b>%s</b>" % header)
        header_label.setAlignment(QtCore.Qt.AlignCenter)

        label = QtGui.QLabel(
            _("please check the following text, then save the file"))
        label.setWordWrap(True)

        self.insertWidget(header_label)
        self.insertWidget(label)

        try:
            f = open(TEMPLATE, "r")
            data = f.read()
            f.close()
        except Exception as exc:
            LOGGER.exception("error opening file")
            data = u"%s<pre>%s</pre>" % (_("couldn't open template file"), exc)

        self.text_edit = QtGui.QTextEdit()
        self.text_edit.setWordWrapMode(QtGui.QTextOption.NoWrap)
        self.text_edit.setFontFamily("Courier")
        self.text_edit.setText(data)

        self.insertWidget(self.text_edit)

        advanced_label = QtGui.QLabel("no advanced features available")

        self.add_advanced_widget(advanced_label)

        self.apply_but.setText("Save")
        self.enableApply()
コード例 #7
0
    def __init__(self, dbname, proxy_client, parent=None):
        ServerFunctionDialog.__init__(self, dbname, proxy_client, parent)

        header = u"%s %s"% (_("Manage User Permissions for database"), dbname)

        self.setWindowTitle(header)

        header_label = QtGui.QLabel("<b>%s</b>"% header)
        header_label.setWordWrap(True)
        header_label.setAlignment(QtCore.Qt.AlignCenter)

        help_label = QtGui.QLabel(u"<p>%s</p><p>%s</p><hr /><em>%s</em>" % (
            _('The supported way of setting permissions is by adding '
            'a user to the one of the predefined permission groups.'),
            _('Check or Uncheck a box to allow this to happen.'),
            _('NOTE - superusers are a special case, and should NEVER be used '
            'as a database user by the openmolar applications.')
            ))
        help_label.setWordWrap(True)

        self.insertWidget(header_label)

        frame = QtGui.QFrame()
        self.insertWidget(frame)
        self.set_advanced_but_text(_("Help"))
        self.add_advanced_widget(help_label)

        self.privileged_cbs = {}
        self.standard_cbs = {}

        layout = QtGui.QGridLayout(frame)

        label = QtGui.QLabel(u"<b>%s</b>"% _("User"))
        label.setAlignment(QtCore.Qt.AlignCenter)
        layout.addWidget(label, 0, 0)

        label = QtGui.QLabel(u"<b>%s</b>"% _("Privilege Level"))
        label.setAlignment(QtCore.Qt.AlignCenter)
        layout.addWidget(label, 0, 1, 1, 2)

        label = QtGui.QLabel(u"<b>%s</b>"% _("Full"))
        label.setAlignment(QtCore.Qt.AlignRight)
        layout.addWidget(label, 1, 1)

        label = QtGui.QLabel(u"<b>%s</b>"% _("Standard"))
        label.setAlignment(QtCore.Qt.AlignLeft)
        layout.addWidget(label, 1, 2)


        self.users = self.proxy_client.get_pg_user_list()
        for i, user in enumerate(self.users):
            row = i+2

            label = QtGui.QLabel(user)
            label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignVCenter)
            layout.addWidget(label, row, 0)

            if user in SUPERUSERS:
                label.setEnabled(False)
                su_label = QtGui.QLabel("N/A - superuser")
                su_label.setAlignment(QtCore.Qt.AlignCenter)
                su_label.setEnabled(False)
                layout.addWidget(su_label, row, 1, 1, 2)
                continue

            perms = self.proxy_client.get_pg_user_perms(user, self.dbname)

            cb1 = QtGui.QCheckBox()
            cb1.setLayoutDirection(QtCore.Qt.RightToLeft)
            cb1.setChecked(perms.get("admin", False))
            self.privileged_cbs[user] = cb1

            cb2 = QtGui.QCheckBox()
            cb2.setChecked(perms.get("client", False))
            self.standard_cbs[user] = cb2

            layout.addWidget(cb1, row, 1)
            layout.addWidget(cb2, row, 2)

            cb1.toggled.connect(self._enable)
            cb2.toggled.connect(self._enable)