Skip to content

Commit

Permalink
feat(dunning): Add permission to analytics overdue balances
Browse files Browse the repository at this point in the history
  • Loading branch information
rsempe committed Sep 10, 2024
1 parent 489c17b commit 4595e76
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/config/permissions/definition.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
analytics:
overdue_balances:
view:
view:
billable_metrics:
view:
Expand Down
2 changes: 2 additions & 0 deletions app/config/permissions/role-finance.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
analytics:
overdue_balances:
view: true
view: true
billable_metrics:
view: false
Expand Down
2 changes: 2 additions & 0 deletions app/config/permissions/role-manager.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
analytics:
overdue_balances:
view: true
view: false
billable_metrics:
view: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class OverdueBalancesResolver < Resolvers::BaseResolver
include AuthenticableApiUser
include RequiredOrganization

REQUIRED_PERMISSION = 'analytics:view'
REQUIRED_PERMISSION = 'analytics:overdue_balances:view'

description 'Query overdue balances of an organization'

Expand Down
1 change: 1 addition & 0 deletions schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'rails_helper'

RSpec.describe Resolvers::Analytics::OverdueBalancesResolver, type: :graphql do
let(:required_permission) { 'analytics:view' }
let(:required_permission) { 'analytics:overdue_balances:view' }
let(:query) do
<<~GQL
query($currency: CurrencyEnum, $externalCustomerId: String, $months: Int, $expireCache: Boolean) {
Expand All @@ -24,7 +24,7 @@

it_behaves_like 'requires current user'
it_behaves_like 'requires current organization'
it_behaves_like 'requires permission', 'analytics:view'
it_behaves_like 'requires permission', 'analytics:overdue_balances:view'

it 'returns a list of overdue balances' do
result = execute_graphql(
Expand Down

0 comments on commit 4595e76

Please sign in to comment.