Skip to content

Commit

Permalink
Merge pull request #34496 from dimagi/jc/remove-feature-flag
Browse files Browse the repository at this point in the history
Remove feature flag for SSO
  • Loading branch information
jingcheng16 authored Apr 24, 2024
2 parents 2fac97b + 132ef8a commit cad3369
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 49 deletions.
14 changes: 3 additions & 11 deletions corehq/apps/sso/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,6 @@ class BaseSsoEnterpriseSettingsForm(forms.Form):
))

def __init__(self, identity_provider, *args, **kwargs):
if 'show_remote_user_management' in kwargs:
self.show_remote_user_management = kwargs.pop('show_remote_user_management')
else:
self.show_remote_user_management = False

self.idp = identity_provider
initial = kwargs['initial'] = kwargs.get('initial', {}).copy()
initial.setdefault('enable_user_deactivation', identity_provider.enable_user_deactivation)
Expand Down Expand Up @@ -877,7 +872,7 @@ def __init__(self, identity_provider, *args, **kwargs):
self.helper.form_class = 'form form-horizontal ko-template'
self.helper.label_class = 'col-sm-3 col-md-2'
self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'
layout = crispy.Layout(
self.helper.layout = crispy.Layout(
crispy.Div(
crispy.Div(
crispy.Fieldset(
Expand Down Expand Up @@ -914,12 +909,9 @@ def __init__(self, identity_provider, *args, **kwargs):
),
css_class="panel panel-modern-gray panel-form-only"
),
crispy.Div(*self.get_remote_user_management_fields()),
crispy.Div(*self.get_primary_fields())
)
if self.show_remote_user_management:
layout.append(crispy.Div(*self.get_remote_user_management_fields()))
layout.append(crispy.Div(*self.get_primary_fields()))

self.helper.layout = layout

def get_remote_user_management_fields(self):
masked_api = get_masked_string(self.idp.api_secret)
Expand Down
43 changes: 21 additions & 22 deletions corehq/apps/sso/static/sso/js/enterprise_edit_identity_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,30 @@ hqDefine('sso/js/enterprise_edit_identity_provider', [
};
}

if (initialPageData.get('show_remote_user_management')) {
self.isCancelUpdateVisible = ko.observable(false);
self.apiExpirationDate = "";
self.isCancelUpdateVisible = ko.observable(false);
self.apiExpirationDate = "";

self.dateApiSecretExpiration = ko.observable($('#id_date_api_secret_expiration').val());
self.isAPISecretVisible = ko.observable($('#masked-api-value').text() === '');
self.apiSecret = ko.observable();
self.dateApiSecretExpiration = ko.observable($('#id_date_api_secret_expiration').val());
self.isAPISecretVisible = ko.observable($('#masked-api-value').text() === '');
self.apiSecret = ko.observable();

self.startEditingAPISecret = function () {
self.isAPISecretVisible(true);
self.isCancelUpdateVisible(true);
// Store the current expiration date before clearing them for editing.
self.apiExpirationDate = self.dateApiSecretExpiration();
self.dateApiSecretExpiration('');
};
self.startEditingAPISecret = function () {
self.isAPISecretVisible(true);
self.isCancelUpdateVisible(true);
// Store the current expiration date before clearing them for editing.
self.apiExpirationDate = self.dateApiSecretExpiration();
self.dateApiSecretExpiration('');
};

self.cancelEditingAPISecret = function () {
self.isAPISecretVisible(false);
self.isCancelUpdateVisible(false);
// Reset the api secret to blank if user cancel editing
self.apiSecret('');
// Restore the original values of expiration date after canceling editing.
self.dateApiSecretExpiration(self.apiExpirationDate);
};

self.cancelEditingAPISecret = function () {
self.isAPISecretVisible(false);
self.isCancelUpdateVisible(false);
// Reset the api secret to blank if user cancel editing
self.apiSecret('');
// Restore the original values of expiration date after canceling editing.
self.dateApiSecretExpiration(self.apiExpirationDate);
};
}

const initialEnforce = $('#id_enforce_user_api_key_expiration').is(':checked');
self.initialExpirationLength =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
{% block page_content %}
{% initial_page_data 'idp_slug' idp_slug %}
{% initial_page_data 'is_oidc' is_oidc %}
{% initial_page_data 'show_remote_user_management' show_remote_user_management %}

<ul class="nav nav-tabs sticky-tabs" id="user-settings-tabs">
<li><a href="#idp" data-toggle="tab">{% trans "Identity Provider" %}</a></li>
Expand Down
8 changes: 0 additions & 8 deletions corehq/apps/sso/views/enterprise_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from django.urls import reverse
from django.utils.translation import gettext as _, gettext_lazy

from corehq import toggles
from corehq.apps.enterprise.views import BaseEnterpriseAdminView
from corehq.apps.hqwebapp.async_handler import AsyncHandlerMixin
from corehq.apps.hqwebapp.decorators import use_jquery_ui
Expand Down Expand Up @@ -71,7 +70,6 @@ def page_context(self):
'edit_idp_form': self.edit_enterprise_idp_form,
'idp_slug': self.idp_slug,
'is_oidc': self.identity_provider.protocol == IdentityProviderProtocol.OIDC,
'show_remote_user_management': self.show_remote_user_management,
}

@property
Expand Down Expand Up @@ -115,18 +113,12 @@ def edit_enterprise_idp_form(self):
self.identity_provider,
self.request.POST,
self.request.FILES,
show_remote_user_management=self.show_remote_user_management
)

return form_class(
self.identity_provider,
show_remote_user_management=self.show_remote_user_management
)

@property
def show_remote_user_management(self):
return toggles.SSO_REMOTE_USER_MANAGEMENT.enabled_for_request(self.request)

def post(self, request, *args, **kwargs):
if self.async_response is not None:
return self.async_response
Expand Down
7 changes: 0 additions & 7 deletions corehq/toggles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,13 +761,6 @@ def _ensure_valid_randomness(randomness):
[NAMESPACE_DOMAIN]
)

SSO_REMOTE_USER_MANAGEMENT = StaticToggle(
'sso_remote_user_management',
"Shows remote user management fields in SSO Identity Provider Form",
TAG_PRODUCT,
[NAMESPACE_DOMAIN, NAMESPACE_USER]
)

BIOMETRIC_INTEGRATION = StaticToggle(
'biometric_integration',
"Enables biometric integration (simprints) features.",
Expand Down

0 comments on commit cad3369

Please sign in to comment.