Skip to content

Commit

Permalink
Restricting oncall feedback permission (#4144)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Dec 18, 2023
1 parent ba4b53c commit 156b5f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/dispatch/feedback/service/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from dispatch.auth.permissions import (
FeedbackDeletePermission,
PermissionsDependency,
SensitiveProjectActionPermission,
)
from dispatch.database.core import DbSession
from dispatch.database.service import search_filter_sort_paginate, CommonParameters
Expand All @@ -15,13 +16,21 @@
router = APIRouter()


@router.get("", response_model=ServiceFeedbackPagination)
@router.get(
"",
response_model=ServiceFeedbackPagination,
dependencies=[Depends(PermissionsDependency([SensitiveProjectActionPermission]))],
)
def get_feedback_entries(commons: CommonParameters):
"""Get all feedback entries, or only those matching a given search term."""
return search_filter_sort_paginate(model="ServiceFeedback", **commons)


@router.get("/{service_feedback_id}", response_model=ServiceFeedbackRead)
@router.get(
"/{service_feedback_id}",
response_model=ServiceFeedbackRead,
dependencies=[Depends(PermissionsDependency([SensitiveProjectActionPermission]))],
)
def get_feedback(db_session: DbSession, service_feedback_id: PrimaryKey):
"""Get a feedback entry by its id."""
feedback = get(db_session=db_session, service_feedback_id=service_feedback_id)
Expand Down
12 changes: 8 additions & 4 deletions src/dispatch/static/dispatch/src/feedback/service/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ const actions = {
{ ...state.table.options },
"ServiceFeedback"
)
return ServiceFeedbackApi.getAll(params).then((response) => {
commit("SET_TABLE_LOADING", false)
commit("SET_TABLE_ROWS", response.data)
})
return ServiceFeedbackApi.getAll(params)
.then((response) => {
commit("SET_TABLE_LOADING", false)
commit("SET_TABLE_ROWS", response.data)
})
.catch(() => {
commit("SET_TABLE_LOADING", false)
})
}, 500),
removeShow({ commit }, feedback) {
commit("SET_DIALOG_DELETE", true)
Expand Down

0 comments on commit 156b5f9

Please sign in to comment.