Revert requiring permission on Slack direct paging (#3881)
Reverting part of https://github.com/grafana/oncall/pull/3861
This commit is contained in:
parent
38deca00d7
commit
5ecdc26b0a
3 changed files with 6 additions and 39 deletions
|
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
|
||||
- Revert requiring permission on Slack direct paging ([#3881](https://github.com/grafana/oncall/pull/3881))
|
||||
|
||||
## v1.3.103 (2024-02-12)
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -123,10 +123,6 @@ class StartDirectPaging(scenario_step.ScenarioStep):
|
|||
slack_team_identity: "SlackTeamIdentity",
|
||||
payload: EventPayload,
|
||||
) -> None:
|
||||
if not self.is_authorized():
|
||||
self.open_unauthorized_warning(payload)
|
||||
return
|
||||
|
||||
input_id_prefix = _generate_input_id_prefix()
|
||||
|
||||
try:
|
||||
|
|
@ -151,18 +147,12 @@ class StartDirectPaging(scenario_step.ScenarioStep):
|
|||
class FinishDirectPaging(scenario_step.ScenarioStep):
|
||||
"""Handle page command dialog submit."""
|
||||
|
||||
REQUIRED_PERMISSIONS = [RBACPermission.Permissions.ALERT_GROUPS_DIRECT_PAGING]
|
||||
|
||||
def process_scenario(
|
||||
self,
|
||||
slack_user_identity: "SlackUserIdentity",
|
||||
slack_team_identity: "SlackTeamIdentity",
|
||||
payload: EventPayload,
|
||||
) -> None:
|
||||
if not self.is_authorized():
|
||||
self.open_unauthorized_warning(payload)
|
||||
return
|
||||
|
||||
message = _get_message_from_payload(payload)
|
||||
private_metadata = json.loads(payload["view"]["private_metadata"])
|
||||
channel_id = private_metadata["channel_id"]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import pytest
|
|||
from django.utils import timezone
|
||||
|
||||
from apps.alerts.models import AlertReceiveChannel
|
||||
from apps.api.permissions import LegacyAccessControlRole
|
||||
from apps.schedules.models import CustomOnCallShift, OnCallScheduleWeb
|
||||
from apps.slack.scenarios.paging import (
|
||||
DIRECT_PAGING_MESSAGE_INPUT_ID,
|
||||
|
|
@ -76,19 +75,6 @@ def test_initial_state(
|
|||
assert metadata[DataKey.USERS] == {}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("role", (LegacyAccessControlRole.VIEWER, LegacyAccessControlRole.NONE))
|
||||
@pytest.mark.django_db
|
||||
def test_initial_unauthorized(make_organization_and_user_with_slack_identities, role):
|
||||
_, user, slack_team_identity, slack_user_identity = make_organization_and_user_with_slack_identities(role=role)
|
||||
payload = {"channel_id": "123", "trigger_id": "111"}
|
||||
|
||||
step = StartDirectPaging(slack_team_identity, user=user)
|
||||
with patch.object(step, "open_unauthorized_warning") as mock_open_unauthorized_warning:
|
||||
step.process_scenario(slack_user_identity, slack_team_identity, payload)
|
||||
|
||||
mock_open_unauthorized_warning.assert_called_once()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_add_user_no_warning(make_organization_and_user_with_slack_identities, make_schedule, make_on_call_shift):
|
||||
organization, user, slack_team_identity, slack_user_identity = make_organization_and_user_with_slack_identities()
|
||||
|
|
@ -245,21 +231,6 @@ def test_trigger_paging_no_team_or_user_selected(make_organization_and_user_with
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("role", (LegacyAccessControlRole.VIEWER, LegacyAccessControlRole.NONE))
|
||||
@pytest.mark.django_db
|
||||
def test_trigger_paging_unauthorized(make_organization_and_user_with_slack_identities, role):
|
||||
organization, user, slack_team_identity, slack_user_identity = make_organization_and_user_with_slack_identities(
|
||||
role=role
|
||||
)
|
||||
payload = make_slack_payload(organization=organization)
|
||||
|
||||
step = FinishDirectPaging(slack_team_identity, user=user)
|
||||
with patch.object(step, "open_unauthorized_warning") as mock_open_unauthorized_warning:
|
||||
step.process_scenario(slack_user_identity, slack_team_identity, payload)
|
||||
|
||||
mock_open_unauthorized_warning.assert_called_once()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_trigger_paging_additional_responders(make_organization_and_user_with_slack_identities, make_team):
|
||||
organization, user, slack_team_identity, slack_user_identity = make_organization_and_user_with_slack_identities()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue