From 5a75db394c1b02148c1124cb922900861596d17c Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 10 Sep 2019 14:46:07 +0200 Subject: [PATCH] [bug] Users with role 'member' cannot download their invoices --- CHANGELOG.md | 2 ++ app/policies/invoice_policy.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df46f4b6a..9308be149 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog Fab Manager +- Fix a bug: Users with role 'member' cannot download their invoices + ## v4.0.4 2019 August 14 - Fix a bug: #140 VAT rate is erronous in invoices. Note: this bug was introduced in v4.0.3 and requires (if you are on v4.0.3) to regenerate the invoices since August 1st (if diff --git a/app/policies/invoice_policy.rb b/app/policies/invoice_policy.rb index 1227f21cd..20489fa7c 100644 --- a/app/policies/invoice_policy.rb +++ b/app/policies/invoice_policy.rb @@ -4,7 +4,7 @@ class InvoicePolicy < ApplicationPolicy end def download? - user.admin? or (record.user_id == user.id) + user.admin? or (record.invoicing_profile.user_id == user.id) end def create?