Commit 9c99c4fe authored by Marin Jankovski's avatar Marin Jankovski

Show different controls on project member page depending on if the membership lock is in place.

parent c19248a2
......@@ -279,4 +279,12 @@ module ProjectsHelper
result.password = '*****' if result.password.present?
result
end
def membership_locked?
if @project.group && @project.group.membership_lock
true
else
false
end
end
end
- user = member.user
%li{id: dom_id(user), class: "team_member_row access-#{member.human_access.downcase}"}
.pull-right
- if current_user_can_admin_project
- unless @project.personal? && user == current_user
.pull-left
= form_for(member, as: :project_member, url: project_team_member_path(@project, member.user)) do |f|
= f.select :access_level, options_for_select(ProjectMember.access_roles, member.access_level), {}, class: "trigger-submit"
 
= link_to project_team_member_path(@project, user), data: { confirm: remove_from_project_team_message(@project, user)}, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from team' do
%i.fa.fa-minus.fa-inverse
- unless membership_locked?
.pull-right
- if current_user_can_admin_project
- unless @project.personal? && user == current_user
.pull-left
= form_for(member, as: :project_member, url: project_team_member_path(@project, member.user)) do |f|
= f.select :access_level, options_for_select(ProjectMember.access_roles, member.access_level), {}, class: "trigger-submit"
 
= link_to project_team_member_path(@project, user), data: { confirm: remove_from_project_team_message(@project, user)}, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from team' do
%i.fa.fa-minus.fa-inverse
= image_tag avatar_icon(user.email, 32), class: "avatar s32"
%p
%strong= user.name
......
%h3.page-title
Users with access to this project
- if can? current_user, :admin_team_member, @project
%span.pull-right
= link_to new_project_team_member_path(@project), class: "btn btn-new btn-grouped", title: "New project member" do
New project member
= link_to import_project_team_members_path(@project), class: "btn btn-grouped", title: "Import members from another project" do
Import members
- unless membership_locked?
- if can?(current_user, :admin_team_member, @project)
%span.pull-right
= link_to new_project_team_member_path(@project), class: "btn btn-new btn-grouped", title: "New project member" do
New project member
= link_to import_project_team_members_path(@project), class: "btn btn-grouped", title: "Import members from another project" do
Import members
%p.light
Read more about project permissions
%strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
- if membership_locked?
%span.pull-right
Adding new user to membership is disabled by a group setting
= render "team", members: @project_members
- if @group
= render "group_members"
......
......@@ -10,3 +10,10 @@
.col-sm-10
= f.text_area :description, maxlength: 250,
class: 'form-control js-gfm-input', rows: 4
.form-group
= f.label :name, class: 'control-label' do
Member lock
.col-sm-10
.checkbox
= f.check_box :membership_lock
%span.descr Prevent adding new members to project membership within this group
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment