Beispiel #1
0
    def __init__(self, jobs_ctx, claimer, user_email):
        super().__init__()
        self.setupUi(self)
        self.jobs_ctx = jobs_ctx
        self.claimer = claimer
        self.claim_job = None
        self.new_device = None
        self.line_edit_user_full_name.setFocus()
        self.line_edit_user_full_name.set_validator(
            validators.NotEmptyValidator())
        self.line_edit_user_full_name.validity_changed.connect(
            self.check_infos)

        self.line_edit_user_email.setText(user_email)
        self.line_edit_user_email.set_validator(validators.EmailValidator())
        self.line_edit_user_email.validity_changed.connect(self.check_infos)

        self.line_edit_device.setText(get_default_device())
        self.line_edit_device.set_validator(validators.DeviceLabelValidator())
        self.line_edit_device.validity_changed.connect(self.check_infos)

        self.claim_success.connect(self._on_claim_success)
        self.claim_error.connect(self._on_claim_error)
        self.label_wait.hide()
        self.button_ok.clicked.connect(self._on_claim_clicked)
        self.check_infos()
 def __init__(self, parent=None):
     super().__init__(parent)
     self.setupUi(self)
     self.button_import_key.clicked.connect(self._on_import_key_clicked)
     self.label_passphrase_error.hide()
     self.line_edit_device.setText(get_default_device())
     self.line_edit_device.validity_changed.connect(self._check_infos)
     self.line_edit_device.set_validator(validators.DeviceLabelValidator())
     self.edit_passphrase.textChanged.connect(
         self._on_passphrase_text_changed)
    def __init__(self, jobs_ctx, greeter, user_profile_outsider_allowed=False):
        super().__init__()
        self.setupUi(self)
        self.jobs_ctx = jobs_ctx
        self.greeter = greeter
        self.get_requests_job = None
        self.create_user_job = None

        self.widget_info.hide()
        self.label_waiting.show()

        self.line_edit_user_full_name.validity_changed.connect(
            self.check_infos)
        self.line_edit_user_full_name.set_validator(
            validators.NotEmptyValidator())
        self.line_edit_user_email.validity_changed.connect(self.check_infos)
        self.line_edit_user_email.set_validator(validators.EmailValidator())
        self.line_edit_device.validity_changed.connect(self.check_infos)
        self.line_edit_device.set_validator(validators.DeviceLabelValidator())
        self.combo_profile.currentIndexChanged.connect(self.check_infos)

        self.combo_profile.addItem(_("TEXT_SELECT_USER_PROFILE"), None)
        self.combo_profile.addItem(_("TEXT_USER_PROFILE_OUTSIDER"),
                                   UserProfile.OUTSIDER)
        self.combo_profile.addItem(_("TEXT_USER_PROFILE_STANDARD"),
                                   UserProfile.STANDARD)
        self.combo_profile.addItem(_("TEXT_USER_PROFILE_ADMIN"),
                                   UserProfile.ADMIN)

        item = self.combo_profile.model().item(2)
        item.setToolTip(_("TEXT_USER_PROFILE_STANDARD_TOOLTIP"))
        item = self.combo_profile.model().item(3)
        item.setToolTip(_("TEXT_USER_PROFILE_ADMIN_TOOLTIP"))

        if not user_profile_outsider_allowed:
            item = self.combo_profile.model().item(1)
            item.setEnabled(False)
            item.setToolTip(_("NOT_ALLOWED_OUTSIDER_PROFILE_TOOLTIP"))
        else:
            item = self.combo_profile.model().item(1)
            item.setToolTip(_("TEXT_USER_PROFILE_OUTSIDER_TOOLTIP"))

        # No profile by default, forcing the greeter to choose one
        self.combo_profile.setCurrentIndex(0)

        self.get_requests_success.connect(self._on_get_requests_success)
        self.get_requests_error.connect(self._on_get_requests_error)
        self.create_user_success.connect(self._on_create_user_success)
        self.create_user_error.connect(self._on_create_user_error)
        self.button_create_user.clicked.connect(self._on_create_user_clicked)

        self.get_requests_job = self.jobs_ctx.submit_job(
            self.get_requests_success, self.get_requests_error,
            self.greeter.get_claim_requests)
Beispiel #4
0
def test_device_label_validator(qtbot, core_config):
    switch_language(core_config, "en")

    le = ValidatedLineEdit()
    le.set_validator(validators.DeviceLabelValidator())
    qtbot.add_widget(le)
    le.show()

    qtbot.keyClicks(le, "abcd")
    qtbot.wait_until(lambda: le.text() == "abcd")
    assert le.is_input_valid()
    assert le.property("validity") == QtGui.QValidator.Acceptable
    def __init__(self, pending, user_profile_outsider_allowed=False):
        super().__init__()
        self.setupUi(self)

        self.label_waiting.hide()

        self.line_edit_user_full_name.validity_changed.connect(
            self.check_infos)
        self.line_edit_user_full_name.set_validator(
            validators.NotEmptyValidator())
        self.line_edit_user_email.validity_changed.connect(self.check_infos)
        self.line_edit_user_email.set_validator(validators.EmailValidator())
        self.line_edit_device.validity_changed.connect(self.check_infos)
        self.line_edit_device.set_validator(validators.DeviceLabelValidator())
        self.combo_profile.currentIndexChanged.connect(self.check_infos)

        self.line_edit_user_full_name.setText(
            pending.submitter_x509_certificate.subject_common_name)
        self.line_edit_user_email.setText(
            pending.submitter_x509_certificate.subject_email_address)
        self.line_edit_device.setText(
            pending.submit_payload.requested_device_label.str)

        self.combo_profile.addItem(translate("TEXT_SELECT_USER_PROFILE"), None)
        self.combo_profile.addItem(translate("TEXT_USER_PROFILE_OUTSIDER"),
                                   UserProfile.OUTSIDER)
        self.combo_profile.addItem(translate("TEXT_USER_PROFILE_STANDARD"),
                                   UserProfile.STANDARD)
        self.combo_profile.addItem(translate("TEXT_USER_PROFILE_ADMIN"),
                                   UserProfile.ADMIN)

        item = self.combo_profile.model().item(2)
        item.setToolTip(translate("TEXT_USER_PROFILE_STANDARD_TOOLTIP"))
        item = self.combo_profile.model().item(3)
        item.setToolTip(translate("TEXT_USER_PROFILE_ADMIN_TOOLTIP"))

        if not user_profile_outsider_allowed:
            item = self.combo_profile.model().item(1)
            item.setEnabled(False)
            item.setToolTip(translate("NOT_ALLOWED_OUTSIDER_PROFILE_TOOLTIP"))
        else:
            item = self.combo_profile.model().item(1)
            item.setToolTip(translate("TEXT_USER_PROFILE_OUTSIDER_TOOLTIP"))

        # No profile by default, forcing the greeter to choose one
        self.combo_profile.setCurrentIndex(0)

        self.button_create_user.clicked.connect(self._on_create_user_clicked)
Beispiel #6
0
 def __init__(self, jobs_ctx, claimer):
     super().__init__()
     self.setupUi(self)
     self.jobs_ctx = jobs_ctx
     self.claimer = claimer
     self.claim_job = None
     self.new_device = None
     self.line_edit_device.setFocus()
     self.line_edit_device.set_validator(validators.DeviceLabelValidator())
     self.line_edit_device.setText(get_default_device())
     self.line_edit_device.textChanged.connect(self._on_device_text_changed)
     self.line_edit_device.validity_changed.connect(self.check_infos)
     self.widget_auth.authentication_state_changed.connect(self.check_infos)
     self.button_ok.setDisabled(True)
     self.claim_success.connect(self._on_claim_success)
     self.claim_error.connect(self._on_claim_error)
     self.label_wait.hide()
     self.button_ok.clicked.connect(self._on_claim_clicked)
Beispiel #7
0
 def __init__(self, jobs_ctx, config, addr):
     super().__init__()
     self.setupUi(self)
     self.status = False
     self.jobs_ctx = jobs_ctx
     self.config = config
     self.dialog = None
     self.addr = addr
     self.label_instructions.setText(
         translate("TEXT_ENROLLMENT_INSTRUCTIONS_organization").format(
             organization=self.addr.organization_id))
     self.label_cert_error.setVisible(False)
     self.widget_user_info.setVisible(False)
     self.button_ask_to_join.setEnabled(False)
     self.button_select_cert.clicked.connect(self._on_select_cert_clicked)
     self.button_ask_to_join.clicked.connect(self._on_ask_to_join_clicked)
     self.line_edit_device.set_validator(validators.DeviceLabelValidator())
     self.line_edit_device.textChanged.connect(self._check_infos)
Beispiel #8
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.line_edit_user_email.validity_changed.connect(self.check_infos)
     self.line_edit_user_email.set_validator(validators.EmailValidator())
     self.line_edit_user_full_name.textChanged.connect(self.check_infos)
     self.line_edit_org_name.validity_changed.connect(self.check_infos)
     self.line_edit_device.setText(get_default_device())
     self.line_edit_device.validity_changed.connect(self.check_infos)
     self.line_edit_device.set_validator(validators.DeviceLabelValidator())
     self.line_edit_org_name.set_validator(
         validators.OrganizationIDValidator())
     self.line_edit_backend_addr.set_validator(
         validators.BackendAddrValidator())
     self.line_edit_backend_addr.validity_changed.connect(self.check_infos)
     self.check_accept_contract.clicked.connect(self.check_infos)
     self.radio_use_commercial.toggled.connect(self._switch_server)
     self.radio_use_custom.toggled.connect(self._switch_server)
     self.radio_use_commercial.setChecked(True)