Skip to content

Commit

Permalink
feat: Do not allow to not enable content on registration dialog
Browse files Browse the repository at this point in the history
* Card ID: CCT-425
* Removed an option to not enable content on registration dialog
* Disable registration using insights-client only in the case,
  when PackageKit is not able to install insights-client
  (PackageKit is not installed, PackageKit is disabled, etc.)
* Removed related integration test
  • Loading branch information
jirihnidek committed Jun 24, 2024
1 parent 3cb7b21 commit 3a545c0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 51 deletions.
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ function openRegisterDialog() {
insights: true,
insights_available: subscriptionsClient.insightsAvailable,
insights_detected: false,
register_method: 'account',
enable_content: true
register_method: 'account'
});

Insights.detect().then(installed => {
Expand Down
2 changes: 1 addition & 1 deletion src/subscriptions-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ client.registerSystem = (subscriptionDetails, update_progress) => new Promise((r
else {
console.debug('registering using username and password');
const registration_options = {
"enable_content": dbus_bool(subscriptionDetails.enable_content)
"enable_content": dbus_bool(true)
};
console.log('registration_options:', registration_options);
if (update_progress)
Expand Down
22 changes: 6 additions & 16 deletions src/subscriptions-register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ class SubscriptionRegisterDialog extends React.Component {
);
}
let insights;
let insights_checkbox_disabled = true;
if (this.props.insights_available === true) {
insights_checkbox_disabled = false;
} else {
if (this.props.enable_content === true) {
insights_checkbox_disabled = false;
}
let insights_checkbox_disabled = false;
// Disable registration of insights-client only in the corner case, when
// insights-client is not installed, and it is not possible to install it,
// because PackageKit is not available
if (this.props.insights_available === false) {
insights_checkbox_disabled = true;
}
insights = [
<FormGroup key="0" fieldId="subscription-insights" label={_("Insights")} hasNoPaddingTop>
Expand Down Expand Up @@ -176,15 +175,6 @@ class SubscriptionRegisterDialog extends React.Component {
</Flex>
{ credentials }
</FormGroup>
<FormGroup className="control-label" label={_("Subscriptions")} hasNoPaddingTop>
<Checkbox id="subscription-enable-content" isChecked={this.props.enable_content}
label={_("Enable content")}
onChange={value => {
this.props.onChange('enable_content', value);
this.props.insights && !value && this.props.onChange('insights', value);
}}
/>
</FormGroup>
{ insights }
</Form>
);
Expand Down
32 changes: 0 additions & 32 deletions test/check-subscriptions
Original file line number Diff line number Diff line change
Expand Up @@ -320,38 +320,6 @@ class TestSubscriptions(SubscriptionsCase):
# find another one that isn't subscribed too
self.wait_subscription(PRODUCT_SHARED, False)

def testRegisterDoNotEnableContent(self):
"""
Test registration without enabled content. Only consumer certificate
should be installed. No entitlement certificate is installed in this
case.
"""
b = self.browser

self.login_and_go("/subscriptions")

# wait until we can open the registration dialog
register_button_sel = "button:contains('Register')"
b.click(register_button_sel)

b.wait_visible("#subscription-register-url")

# enter server and correct login data
b.set_val("#subscription-register-url", "custom")
b.set_input_text("#subscription-register-url-custom", CANDLEPIN_URL)
b.set_input_text("#subscription-register-username", "admin")
b.set_input_text("#subscription-register-password", "admin")
b.set_input_text("#subscription-register-org", "donaldduck")

b.click("#subscription-enable-content")

dialog_register_button_sel = "footer .pf-m-primary"
b.click(dialog_register_button_sel)

# dialog should disappear
with b.wait_timeout(60):
b.wait_not_present(dialog_register_button_sel)

def testUnpriv(self):
self.machine.execute("useradd junior; echo junior:foobar | chpasswd")
self.login_and_go("/subscriptions", user="junior")
Expand Down

0 comments on commit 3a545c0

Please sign in to comment.