Hide list of members in project overview
Added by Joe Chin almost 16 years ago
For security purposes I would like to suppress the list of members in the project overview to everyone accept the project admistrators.
In app/views/projects/show.rhtml I'm trying to modify this block of code
<div class="splitcontentright"> <% if @members_by_role.any? %> <div class="box"> <h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3> <p><% @members_by_role.keys.sort.each do |role| %> <%= role.name %>: <%= @members_by_role[role].collect(&:user).sort.collect{|u| link_to_user u}.join(", ") %> <br /> <% end %></p> </div> <% end %>
I believe what I need is @members_by_role.admin or something like that. I believe I can do this in projects_controller.rb in app/controller/ but it causes an error when I display the page.
Replies (28)
RE: Hide list of members in project overview - Added by Eric Davis almost 16 years ago
Just add a check to see if the current user is an admin:
<div class="splitcontentright"> <% if User.current.admin? && @members_by_role.any? %> <div class="box"> <h3 class="icon22 icon22-users"><%=l(:label_member_plural)%></h3> <p><% @members_by_role.keys.sort.each do |role| %> <%= role.name %>: <%= @members_by_role[role].collect(&:user).sort.collect{|u| link_to_user u}.join(", ") %> <br /> <% end %></p> </div> <% end %>
Eric
RE: Hide list of members in project overview - Added by Joe Chin almost 16 years ago
That works alright, but how would I grant access to someone that isn't a site administrator. I see the admin property is not treated the same as regular roles.
I imagine something like
User.current.projects(@project).role.name == 'Developer' && @members_by_role.any?
RE: Hide list of members in project overview - Added by Joshua Villagomez over 13 years ago
I had a need to do this myself. With 1.1.2, little different. Edited first line of /home/redmine/redmine-1.1.2/views/projects/_members_box.html.erb with following:
<% if User.current.admin? %>
Now, only admins can see the members box.
RE: Hide list of members in project overview - Added by steven gebbie about 13 years ago
Is there any way to change this so that all users only see some of the users. ie they see a list off all other members with the same role that they have.
so it I am a developer I;d ses the other developers, but none of the admins or anyother users.
thanks
RE: Hide list of members in project overview - Added by steven gebbie about 13 years ago
basically
is there a way to do User.current.projects(Herve Harster).role.name == 'Developer' && @members_by_role.any?
or something
steven gebbie wrote:
Is there any way to change this so that all users only see some of the users. ie they see a list off all other members with the same role that they have.
so it I am a developer I;d ses the other developers, but none of the admins or anyother users.thanks
RE: Hide list of members in project overview - Added by Pat Laporte about 13 years ago
Helo all,
Im a redmine newbie discovering the 1.2 version..
I was also looking for this function because we dont want to expose
private information such as users and profile belonging to a project.
<% if User.current.admin? %> is working but I would like to extend this
to the project manager role or even developers.
So, I'm still looking for a method to do it
Hopeless ? ;-)
plap
RE: Hide list of members in project overview - Added by Johann Fakra almost 13 years ago
Hello everyone,
I find a way to do a test on the role, not very proper, but works... :)
<% if authorize_for('members', 'new') %> for example.
And just one role is about to do this, so works for all roles that can create new member...
If someone finds a proper way to test on the role itself, i'm really interested...
Take care and have a merry christmas... :)
RE: Hide list of members in project overview - Added by TJ Wrenn almost 13 years ago
Hi everyone,
I was able to achieve this by adding the following condition to app/views/projects/_members_box.html.erb
<% if @users_by_role.any? && User.current.roles_for_project(Herve Harster).include?(Role.find(:first, :conditions => "name='Project Manager'")) %>
I am not sure if that is the best way to perform this check, but it is working at least :-)
If anyone knows a better way of doing this, I would be interested to know.
Hope this helps!
~TJ
RE: Hide list of members in project overview - Added by Joe Chin almost 13 years ago
TJ Wrenn wrote:
Hi everyone,
I was able to achieve this by adding the following condition to app/views/projects/_members_box.html.erb
<% if @users_by_role.any? && User.current.roles_for_project(Herve Harster).include?(Role.find(:first, :conditions => "name='Project Manager'")) %>
I am not sure if that is the best way to perform this check, but it is working at least :-)
If anyone knows a better way of doing this, I would be interested to know.Hope this helps!
~TJ
I tried this but only get error.
RE: Hide list of members in project overview - Added by William Conley almost 13 years ago
<% if User.current.admin? %> this one worked for me as well. I'll eventually modify it to check for a "View Members" role to allow explicitly allowing users by adding a role for any user whom I want to see this pane.
However, I'll also need to modify the list to remove our employees who may be assigned to the project, or perhaps "omit" Managers from the "Members" list.
Thanks for the help from the board!
Bill
RE: Hide list of members in project overview - Added by Johann Fakra almost 13 years ago
Hi everyone,
I was able to achieve this by adding the following condition to app/views/projects/_members_box.html.erb
<% if @users_by_role.any? && User.current.roles_for_project(Herve Harster).include?(Role.find(:first, :conditions => "name='Project Manager'")) %>
I am not sure if that is the best way to perform this check, but it is working at least :-)
If anyone knows a better way of doing this, I would be interested to know.Hope this helps!
~TJ
Works very good to me... But I have Redmine 1.3 on my server.
I tried this but only get error.
Joe, maybe you have an old version of Redmine, that's why you get an error.
Also, have to check the name of Role. For me, I had to put 'Manager'. But no error if i put the wrong name.
Also, it could be good to add a module for this. Because, not very clean to change Redmine core... If anyone knows an existant module for this... Could be great.. .:)
Have a good day, and a Happy new year... :)
RE: Hide list of members in project overview - Added by Richard Rauch over 12 years ago
Hi All,
I am very new in Redmine. I installed Version 1.4.2 (Bitnami setup)
I want to hide member list in project overview too. but I cannot find the mentioned file "app/views/projects/show.rhtml"
please can you explain in detail, what I have to do in Version 1.4?
Thanks
Richard
RE: Hide list of members in project overview - Added by Etienne Massip over 12 years ago
.rhtml
file extension has been replaced with .html.erb
.
RE: Hide list of members in project overview - Added by Richard Rauch over 12 years ago
Etienne E: thanks a lot
I think, I have found now the mentioned file, but I would need further help.
I assume the relevant code in show.html.erb is this:
<div class="splitcontentright"> <%= render :partial => 'members_box' %> <% if @news.any? && authorize_for('news', 'index') %> <div class="news box"> <h3><%=l(:label_news_latest)%></h3> <%= render :partial => 'news/news', :collection => @news %> <p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p> </div> <% end %> <%= call_hook(:view_projects_show_right, :project => @project) %> </div>
but the code is very different. I assume (but I do not know this programming language), it is moved to something called "view_projects_show_right"...but I cannot find this name somewhere else in the whole redmine directory (text search).
please give me an additional hint (I promise, I will learn very fast, I am a very experienced C/C++ programer) ;-)
RE: Hide list of members in project overview - Added by Etienne Massip over 12 years ago
view_projects_show_right
is a hook that allows a plugin to get the hand at runtime when the hook is called.
You should check for some app/views/projects/_members_box.html.erb
instead.
RE: Hide list of members in project overview - Added by Richard Rauch over 12 years ago
Many Thanks again...it works!!!
In the file, you mentioned, I found the relevant code.
I have changed the if clause according to previous post in this thread:
<% if User.current.admin? && @members_by_role.any? %>
and it works as expected!
in principle I have finished this issue now. But this change is made in the redmine sources itself.
I should create a plugin, which will replace the standard functionality with the new behaviour.
you told already, view_projects_show_right is a hook for plugins. Can I use this? Can you give me a link to an example, how to work with such hooks in plugins?
Richard
RE: Hide list of members in project overview - Added by Etienne Massip over 12 years ago
You could start by reading Hooks.
plugin? - Added by Carmelo Caruso almost 11 years ago
hello, the last line of the discussion ara focusing on a plugin project. Has it been implemented?
Please help! I have the same BIG problem of hiding the list of the project users for security reason and commercial information hiding (I don't want the users to be able to know who they are and how many!).
Best regards.
RE: Hide list of members in project overview - Added by Lucky Boy about 10 years ago
RE: Hide list of members in project overview - Added by Alexander Meindl almost 10 years ago
If you want to hide a specific role, you can try Redmine Tweaks
RE: Hide list of members in project overview - Added by Oleg Vlasenko almost 10 years ago
Alexander Meindl wrote:
If you want to hide a specific role, you can try Redmine Tweaks
Hello, Alexander.
I have the same issue as described above. I’ve tried Redmine_tweaks plugin. It is really helpful thing. Many thanx for your work. However I did not find ‘Hide role in project memberbox’ options in the plugin configuration. I work with Redmine 2.6.0 and Redmine_tweaks 0.5.1
Could you please explore how and where ‘Hide role in project memberbox’ is configured.
Thank you.
RE: Hide list of members in project overview - Added by Alexander Meindl almost 10 years ago
Hi Oleg,
you find a new permission for it in the permission setting. Select the role you want to hide and activate `hide role in memberbox'
RE: Hide list of members in project overview - Added by Oleg Vlasenko almost 10 years ago
Alexander Meindl wrote:
Hi Oleg,
you find a new permission for it in the permission setting. Select the role you want to hide and activate `hide role in memberbox'
Super!Thanx!
RE: Hide list of members in project overview - Added by Joel Bearden over 8 years ago
Yea. This doesn't work in Redmine 3.3.
What am I missing?
RE: Hide list of members in project overview - Added by Luis Blasco over 8 years ago
You have to install the Redmine Tweaks plugin http://www.redmine.org/plugins/redmine_tweaks. Then you will find the permission to hide or activate the memberbox.