uclibs / treatment_database

Application to track conservation workflow for Preservation Services
1 stars 2 forks source link

482 - Correct staff codes access #483

Closed Janell-Huyck closed 5 months ago

Janell-Huyck commented 5 months ago

We had no link on the admin header for staff codes, and standard users were able to access this page.

This PR corrects these two errors, adding a link in the admin header and removing access for the standard users.

Additionally, we are removing the ability for any user to delete or destroy a staff code. If the preservation team needs to remove a staff code in the future, we will need to do it for them.

File changes:

Additional changes to increase coveralls %

These changes reduced the number of lines in controllers, and thus reduced the % of testing. I discovered an unreachable call to "super" in app/controllers/users/registrations_controller.rb which couldn't be tested because it was never called. Deleting this line increased our testing % from -0.1% to -0.01%.

Adding and configuring a test for the Devise mailer allows us to indirectly test our ApplicationMailer. Devise inherits from the ApplicationMailer class. We're not using the ApplicationMailer directly anywhere, but Devise will pull defaults from our class. This was as close as I could get to testing ApplicationMailer.

This increase in testing was not recognized by Coveralls, so I created yet another file: spec/mailers/application_mailer_spec.rb which has some very simple tests about the content of that class. This bumped our spec % from -0.01% to +0.5%

hortongn commented 5 months ago

Let's discuss this with @crowesn. We may not want to give CRUD access for staff codes to anyone. I think it's very rare a new staff code would be needed. Also seems dangerous to allow them to delete a staff code when it is linked to repair records.

Janell-Huyck commented 5 months ago

Link to Teams discussion: https://teams.microsoft.com/l/message/19:597d4e762f5648c49087dacf89dc415e@thread.skype/1713900125433?tenantId=f5222e6c-5fc6-48eb-8f03-73db18203b63&groupId=05379e3e-d136-48a1-ba71-81ecaf83cfab&parentMessageId=1713900125433&teamName=UCL%20Application%20Development%20Unit&channelName=treatment-db&createdTime=1713900125433&allowXTenantAccess=false