Skip to content

Commit daec94b

Browse files
feat: update saml management command
1 parent a68d3e6 commit daec94b

File tree

1 file changed

+10
-6
lines changed
  • common/djangoapps/third_party_auth/management/commands

1 file changed

+10
-6
lines changed

common/djangoapps/third_party_auth/management/commands/saml.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,13 @@ def _handle_run_checks(self, options):
7979
This is a report-only command. It identifies potential configuration problems such as:
8080
- Outdated SAMLConfiguration references (provider pointing to old config version)
8181
- Site ID mismatches between SAMLProviderConfig and its SAMLConfiguration
82-
- Slug mismatches between SAMLProviderConfig and its SAMLConfiguration (except when slug is 'default' which may be intentional)
82+
- Slug mismatches between SAMLProviderConfig and its SAMLConfiguration
83+
(except when slug is 'default' which may be intentional)
8384
- SAMLProviderConfig objects with null SAMLConfiguration references (informational)
8485
8586
Includes observability attributes for monitoring.
8687
"""
87-
site_id = options.get('site_id')
88-
89-
# Set custom attributes for monitoring the check operation
88+
site_id = options.get('site_id') # Set custom attributes for monitoring the check operation
9089
# .. custom_attribute_name: saml_management_command.operation
9190
# .. custom_attribute_description: Records current SAML operation ('run_checks').
9291
set_custom_attribute('saml_management_command.operation', 'run_checks')
@@ -119,7 +118,10 @@ def _check_provider_configurations(self, site_id):
119118

120119
for provider_config in provider_configs:
121120
total_providers += 1
122-
provider_info = f"Provider '{provider_config.slug}' (ID: {provider_config.id}, site {provider_config.site_id})"
121+
provider_info = (
122+
f"Provider '{provider_config.slug}' "
123+
f"(ID: {provider_config.id}, site {provider_config.site_id})"
124+
)
123125

124126
if not provider_config.saml_configuration:
125127
self.stdout.write(f"[INFO] {provider_info} has no SAML configuration (may be intentional)")
@@ -144,7 +146,9 @@ def _check_provider_configurations(self, site_id):
144146
# No current config found - this might indicate the referenced config is no longer valid
145147
self.stdout.write(
146148
f"[WARNING] {provider_info} "
147-
f"references config (ID: {provider_config.saml_configuration_id}) but no current config found for site {provider_config.saml_configuration.site_id}, slug '{provider_config.saml_configuration.slug}'"
149+
f"references config (ID: {provider_config.saml_configuration_id}) but no current config "
150+
f"found for site {provider_config.saml_configuration.site_id}, "
151+
f"slug '{provider_config.saml_configuration.slug}'"
148152
)
149153
outdated_count += 1
150154

0 commit comments

Comments
 (0)