Skip to content

About

Restricts user profile visibility to admins and the user themselves

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Visibility Restriction Plugin

Description

Hides a user's email and login from everyone except:

  • admins,
  • the user themselves,
  • members of a configurable staff group.

Everyone else (anonymous visitors, customers) still sees the profile page and the /users/:id.json API response, just without those fields.

  • Email: hidden everywhere Redmine checks "Hide my email address": the profile page, the users API, Atom feeds, and plugins that honour the same preference (e.g. additionals' {{members}} / {{group_users}} macros). A user who ticked "Hide my email address" keeps it hidden from staff too; admins still get it through the API, as in core. User autocompletes (watchers, mentions, members, zenedit) no longer match on email for these viewers, so a guessed address can't be confirmed by typing it.
  • Login: hidden on the profile page and in the users API only. Logins still appear in @mentions, mention autocomplete and some plugin macros, so treat this as reducing exposure, not as a secret.

Which users anyone can open at all is still governed by core's per-role "Users visibility" setting.

Installation

  1. Put the plugin in plugins/redmine_plugin_user_visibility (the directory name must match the registered plugin id).
  2. Restart Redmine.
  3. Administration > Plugins > Redmine User Visibility Restriction > Configure: pick the staff group. Until a group is chosen, only admins and the user themselves see logins and emails. If the chosen group is later deleted, the settings page says so.

How it works

  • Email: UserPreference#hide_mail reads as true for viewers who may not see the user's details. Only the reader changes; the stored value, and what the user sees on their own account page, stay as they are.
  • Autocomplete: Principal.like keeps core's matching, narrowed to login and name matches for viewers who may not see emails.
  • Login: the plugin overrides users/show.html.erb and users/show.api.rsb with copies of Redmine 6.1's views in which only the login line is changed. test/unit/view_overrides_test.rb undoes that edit and compares the result with the running Redmine's own views, so a Redmine upgrade that changes either view fails the test; refresh the copies from the new core views and re-apply the edit.

Side effects: three core tests fail with the plugin installed, by design. Two users API tests (test/integration/api_test/users_test.rb) expect a non-admin to get another user's login, and PrincipalTest#test_like_scope_should_search_mail expects user search to match emails for a non-staff viewer.

Tests

From the Redmine root:

bundle exec rails test plugins/redmine_plugin_user_visibility/test

Compatibility

  • Redmine 6.1 and 7.0

About

Restricts user profile visibility to admins and the user themselves

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages