specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
62 stars 36 forks source link

Delete button visible in grid subviews for users without delete permission #5150

Open lexiclevenger opened 1 month ago

lexiclevenger commented 1 month ago

Describe the bug A non-functional delete button is present next to records in a subview when it is in grid view. This button is still visible to users who have read permission and create or update permission for all tables, but not delete permission.

We have noticed that our users that have a specific role assigned to them which gives edit rights but not delete permissions have the ‘trash’ symbol shown for the subsections in records. When the button is clicked, nothing happens.

This is very confusing for the user – would it be possible to get this removed when no Delete permission is given for any table?

The only Delete permissions for this role are related to queries, record sets, and Workbench files.

To Reproduce Steps to reproduce the behavior:

  1. Go to User tools > Accounts and Security
  2. Create a user with read, create, and update, but NOT delete permissions enabled for all tables. You can import this file: User Roles - Collection Officer - Fri Jul 26 2024.json
  3. Log in as that user
  4. Create a CO record, add records to a subview like Determinations, and save
  5. Find the Form Meta for a subview and make sure the Type is set to "Grid"
  6. See "delete" button

Expected behavior To be consistent with other delete buttons, this button should be hidden from users without delete permissions for any table.

Screenshots

Screenshot from Corinna P: image (1)

Specify 7 System Information - 2024-07-26T21_02_44.770Z.txt

Please, also fill out the following information manually:

Reported by: Corinna P @ CSIRO via Asana

emenslin commented 1 month ago

Can recreate in edge (7.9.6.2) however the delete button is grayed out and only visible after a record is saved

https://github.com/user-attachments/assets/0e9b300e-13b4-4e7d-9e05-59acb981eba7

CarolineDenis commented 1 week ago

NOTES: && maybe not || https://github.com/specify/specify7/blob/f58f0d43c4441ee1718ab92823f9a1da3d98bed2/specifyweb/frontend/js_src/lib/components/FormCells/FormTable.tsx#L402