From db18c3789cae7eb400b1b7d8daadaed3cd3481e1 Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Thu, 24 Feb 2022 10:01:45 -0500 Subject: [PATCH] Add Pushover.net support from LDAP sync --- configs/config.yaml | 1 + db/schema.v0.sql | 2 +- src/oncall/constants.py | 1 + src/oncall/messengers/iris_messenger.py | 4 ++-- src/oncall/ui/templates/index.html | 4 ++++ src/oncall/user_sync/ldap_sync.py | 3 ++- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/configs/config.yaml b/configs/config.yaml index 9abfd740..e17d5ac2 100644 --- a/configs/config.yaml +++ b/configs/config.yaml @@ -230,5 +230,6 @@ require_auth: False # username: 'sAMAccountName' # full_name: 'displayName' # mail: 'mail' +# pushover: 'pushover' # mobile: 'mobile' # image_url: 'https://image.example.com/api/%s/picture' diff --git a/db/schema.v0.sql b/db/schema.v0.sql index 34614c36..cf5dda86 100644 --- a/db/schema.v0.sql +++ b/db/schema.v0.sql @@ -313,7 +313,7 @@ CREATE TABLE IF NOT EXISTS `contact_mode` ( -- Initialize contact modes -- ----------------------------------------------------- INSERT IGNORE INTO `contact_mode` (`name`) -VALUES ('email'), ('sms'), ('call'), ('slack'), ('teams_messenger'); +VALUES ('email'), ('sms'), ('call'), ('slack'), ('teams_messenger'), ('pushover'); -- ----------------------------------------------------- -- Table `user_contact` diff --git a/src/oncall/constants.py b/src/oncall/constants.py index 91bbb542..751a4d9c 100644 --- a/src/oncall/constants.py +++ b/src/oncall/constants.py @@ -5,6 +5,7 @@ SMS_SUPPORT = 'sms' CALL_SUPPORT = 'call' SLACK_SUPPORT = 'slack' +PUSHOVER_SUPPORT = 'pushover' ROCKET_SUPPORT = 'rocketchat' TEAMS_SUPPORT = 'teams_messenger' diff --git a/src/oncall/messengers/iris_messenger.py b/src/oncall/messengers/iris_messenger.py index 5791d75b..d8ac5839 100644 --- a/src/oncall/messengers/iris_messenger.py +++ b/src/oncall/messengers/iris_messenger.py @@ -2,12 +2,12 @@ # See LICENSE in the project root for license information. -from oncall.constants import EMAIL_SUPPORT, SMS_SUPPORT, CALL_SUPPORT, SLACK_SUPPORT +from oncall.constants import EMAIL_SUPPORT, SMS_SUPPORT, CALL_SUPPORT, SLACK_SUPPORT, PUSHOVER_SUPPORT from irisclient import IrisClient class iris_messenger(object): - supports = frozenset([EMAIL_SUPPORT, SMS_SUPPORT, CALL_SUPPORT, SLACK_SUPPORT]) + supports = frozenset([EMAIL_SUPPORT, SMS_SUPPORT, CALL_SUPPORT, SLACK_SUPPORT, PUSHOVER_SUPPORT]) def __init__(self, config): self.iris_client = IrisClient(config['application'], config['iris_api_key'], config['api_host']) diff --git a/src/oncall/ui/templates/index.html b/src/oncall/ui/templates/index.html index ec0bcafa..c4f9b48c 100644 --- a/src/oncall/ui/templates/index.html +++ b/src/oncall/ui/templates/index.html @@ -517,6 +517,7 @@ {{/isEqual}}
  • Slack: {{getUserInfo this @root.users 'contacts.slack'}}
  • +
  • Pushover: {{getUserInfo this @root.users 'contacts.pushover'}}
  • E-Mail: {{getUserInfo this @root.users 'contacts.email'}}
  • @@ -570,6 +571,7 @@

    On Call Now

  • Call: {{#if user_contacts.call}} {{user_contacts.call}} {{else}} No number found! {{/if}}
  • SMS: {{#if user_contacts.sms}} {{user_contacts.sms}} {{else}} No number found! {{/if}}
  • Slack: {{user_contacts.slack}}
  • +
  • Pushover: {{user_contacts.pushover}}
  • E-Mail: {{user_contacts.email}}