Skip to content

Commit

Permalink
Merge branch 'main' into Matvey-Kuk/fix-hardcoded-app-id
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk authored Nov 11, 2024
2 parents 2989d53 + 3d6d5f1 commit f47ff60
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion keep/api/core/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def get_pusher_client() -> Pusher | None:
pusher_app_secret = os.environ.get("PUSHER_APP_SECRET")
if (
PUSHER_DISABLED
or pusher_host is None
or pusher_app_id is None
or pusher_app_key is None
or pusher_app_secret is None
Expand Down
5 changes: 5 additions & 0 deletions keep/providers/servicenow_provider/servicenow_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def validate_scopes(self):
Validates that the user has the required scopes to use the provider.
"""
try:
self.logger.info("Validating ServiceNow scopes")
url = f"{self.authentication_config.service_now_base_url}/api/now/table/sys_user_role?sysparm_query=user_name={self.authentication_config.username}"
response = requests.get(
url,
Expand All @@ -86,19 +87,23 @@ def validate_scopes(self):
self.authentication_config.password,
),
verify=False,
timeout=10,
)
if response.status_code == 200:
roles = response.json()
roles_names = [role.get("name") for role in roles.get("result")]
if "itil" in roles_names:
self.logger.info("User has ITIL role")
scopes = {
"itil": True,
}
else:
self.logger.info("User does not have ITIL role")
scopes = {
"itil": "This user does not have the ITIL role",
}
else:
self.logger.info("Failed to get roles from ServiceNow")
scopes["itil"] = "Failed to get roles from ServiceNow"
except Exception as e:
self.logger.exception("Error validating scopes")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "keep"
version = "0.28.5"
version = "0.28.6"
description = "Alerting. for developers, by developers."
authors = ["Keep Alerting LTD"]
readme = "README.md"
Expand Down

0 comments on commit f47ff60

Please sign in to comment.