-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Renting manager role #916
base: staging
Are you sure you want to change the base?
Conversation
@@ -63,7 +63,7 @@ | |||
</tbody> | |||
</table> | |||
|
|||
<% unless @invoice.paid? %> | |||
<% unless !policy(Invoice).send_invoice? || @invoice.paid? %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean?
and why is the change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A user with the renting manager role can also access this page. However, they are not allowed to send an invoice, so for them the url should not appear on the page. So we check here with the policy for invoices (described in app/policies/invoice_policy.rb) whether the person accessing the page is allowed to send an invoice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this there was no renting manager role, so the check was unnecessary as only treasurers (who are allowed to send invoice) could access this page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be rewrite so it is not a "unless not"statement to improve readabilty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<% unless !policy(Invoice).send_invoice? || @invoice.paid? %> | |
<% if policy(Invoice).send_invoice? && !@invoice.paid? %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested and it looks good, you said in the description that test are not written in a consistent way. Could you elaborate on that so it can be fixed in the future? Sorry, it took so long to review it hopefully things improve in the future. for now Good Work Ellen.
@@ -47,7 +47,11 @@ | |||
<%= activity.price_list.name %> | |||
</td> | |||
<td> | |||
<%= link_to activity.created_by.name, activity.created_by %> | |||
<% if policy(activity.created_by).show? %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't completely understand how this request works?
fixed inconsistent order
fixed inconsistent order
fixed inconsistent order
fixed inconsistent order
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## staging #916 +/- ##
==========================================
Coverage ? 75.15%
==========================================
Files ? 55
Lines ? 1115
Branches ? 0
==========================================
Hits ? 838
Misses ? 277
Partials ? 0 ☔ View full report in Codecov by Sentry. |
nevermind my bug fix broke the tests |
Added a role for renting managers with which they have the following permissions:
The following permissions were changed for main bartenders (after talking to Soccie):
I also added tests for the new renting-manager role and added some tests that were missing for some controllers. The syntax used is a bit inconsistent across tests (also in the already existing tests), I will fix this in some another pull request in the future.
To easily log in as the different roles, I added new users to the seeding of AMBER-API which are linked to SOFIA roles in the seeding of SOFIA, see #412