Skip to content

Added view/edit user contact information permission (take 2)#18903

Open
snipe wants to merge 31 commits intomasterfrom
_view-user-address-permission-take-2
Open

Added view/edit user contact information permission (take 2)#18903
snipe wants to merge 31 commits intomasterfrom
_view-user-address-permission-take-2

Conversation

@snipe
Copy link
Copy Markdown
Member

@snipe snipe commented Apr 17, 2026

(I had tried this before, but too much changed since then so I just started again, building off what I had before.)

This is primarily targeted towards special cases such as domestic violence centers where a stalker might end up volunteering for the shelter. This allows the volunteer to be able to edit basic information, checkin/checkout assets, etc - but they cannot see or edit the users':

  • email
  • phone
  • mobile
  • address info
  • website

This also fixes #18659.

This thing is an absolute beast, but I had to make sure I wasn't missing any potential spots where we could leak information. I've added a ton of tests to hopefully prevent any regressions.

This adds a migration to automatically add the users.contact permission to any user/group who had users.edit access, because this permission is more restrictive and could cause confusion if we took it away and someone didn't notice.

One of the reasons why this ended up touching so many files and being super complicated is because there are lots of clever ways people could try to figure out someone's information even if we're not displaying it directly, for example searching on an old, known phone number could still reveal more information than we want, either through the user search API or by searching the activity report for the "old" value - so I had to build workarounds for that. (In other words, even if the response payload masked phone/email values, a known old phone number could still be used as a search term to produce a hit.)

We also had to suppress the sensitive fields on the edit, view and clone screens, and suppress the edited fields in the log_meta on display.

Aaaand we had to skip the sensitive fields in the user import. We now flash a warning that those fields will be skipped if the user doesn't have permission to view those sensitive fields:

Screenshot 2026-04-17 at 6 11 09 PM

Superadmin View

FireShot Capture 099 - View User Bennie Walsh __ Snipe-IT Demo -  snipe-it test Screenshot 2026-04-17 at 6 44 05 PM Screenshot 2026-04-17 at 6 46 31 PM

Contact info DENIED

FireShot Capture 003 - View User Bennie Walsh __ Snipe-IT Demo -  snipe-it test Screenshot 2026-04-17 at 6 44 23 PM Screenshot 2026-04-17 at 6 45 13 PM

@snipe snipe changed the title View user address permission take 2 Added view/edit user contact information permission (take 2) Apr 17, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 17, 2026

Not up to standards ⛔

🔴 Issues 2 medium

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
UnusedCode 2 medium

View in Codacy

🟢 Metrics 92 complexity

Metric Results
Complexity 92

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: More data in USER .csv export

1 participant