Commit d315d1eb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Dont allow guest to set assigne, milestone and label when create new issue or merge request

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 60baa1e8
...@@ -154,6 +154,9 @@ class Ability ...@@ -154,6 +154,9 @@ class Ability
project_guest_rules + [ project_guest_rules + [
:download_code, :download_code,
:fork_project, :fork_project,
:set_assignee,
:set_milestone,
:set_label,
:write_project_snippet :write_project_snippet
] ]
end end
......
...@@ -37,47 +37,50 @@ ...@@ -37,47 +37,50 @@
.clearfix .clearfix
.error-alert .error-alert
%hr %hr
.form-group - if can?(current_user, :set_assignee, @project)
.issue-assignee .form-group
= f.label :assignee_id, class: 'control-label' do .issue-assignee
%i.fa.fa-user = f.label :assignee_id, class: 'control-label' do
Assign to %i.fa.fa-user
.col-sm-10 Assign to
= users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]", .col-sm-10
placeholder: 'Select a user', class: 'custom-form-control', null_user: true, = users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]",
selected: issuable.assignee_id, project: @target_project || @project) placeholder: 'Select a user', class: 'custom-form-control', null_user: true,
&nbsp; selected: issuable.assignee_id, project: @target_project || @project)
= link_to 'Assign to me', '#', class: 'btn assign-to-me-link' &nbsp;
.form-group = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
.issue-milestone - if can?(current_user, :set_milestone, @project)
= f.label :milestone_id, class: 'control-label' do .form-group
%i.fa.fa-clock-o .issue-milestone
Milestone = f.label :milestone_id, class: 'control-label' do
%i.fa.fa-clock-o
Milestone
.col-sm-10
- if milestone_options(issuable).present?
= f.select(:milestone_id, milestone_options(issuable),
{ include_blank: 'Select milestone' }, { class: 'select2' })
- else
.prepend-top-10
%span.light No open milestones available.
&nbsp;
- if can? current_user, :admin_milestone, issuable.project
= link_to 'Create new milestone', new_namespace_project_milestone_path(issuable.project.namespace, issuable.project), target: :blank
- if can?(current_user, :set_label, @project)
.form-group
= f.label :label_ids, class: 'control-label' do
%i.fa.fa-tag
Labels
.col-sm-10 .col-sm-10
- if milestone_options(issuable).present? - if issuable.project.labels.any?
= f.select(:milestone_id, milestone_options(issuable), = f.collection_select :label_ids, issuable.project.labels.all, :id, :name,
{ include_blank: 'Select milestone' }, { class: 'select2' }) { selected: issuable.label_ids }, multiple: true, class: 'select2'
- else - else
.prepend-top-10 .prepend-top-10
%span.light No open milestones available. %span.light No labels yet.
&nbsp; &nbsp;
- if can? current_user, :admin_milestone, issuable.project - if can? current_user, :admin_label, issuable.project
= link_to 'Create new milestone', new_namespace_project_milestone_path(issuable.project.namespace, issuable.project), target: :blank = link_to 'Create new label', new_namespace_project_label_path(issuable.project.namespace, issuable.project), target: :blank
.form-group
= f.label :label_ids, class: 'control-label' do
%i.fa.fa-tag
Labels
.col-sm-10
- if issuable.project.labels.any?
= f.collection_select :label_ids, issuable.project.labels.all, :id, :name,
{ selected: issuable.label_ids }, multiple: true, class: 'select2'
- else
.prepend-top-10
%span.light No labels yet.
&nbsp;
- if can? current_user, :admin_label, issuable.project
= link_to 'Create new label', new_namespace_project_label_path(issuable.project.namespace, issuable.project), target: :blank
- if issuable.is_a?(MergeRequest) - if issuable.is_a?(MergeRequest)
%hr %hr
......
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