mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-08 14:15:35 +08:00
Allow tag creation on task level if you have permission [SCI-6573] (#4031)
This commit is contained in:
parent
e6cd26118c
commit
2b2888e6f7
2 changed files with 12 additions and 19 deletions
|
@ -2,7 +2,6 @@ class TagsController < ApplicationController
|
|||
before_action :load_vars, only: [:create, :update, :destroy]
|
||||
before_action :load_vars_nested, only: [:update, :destroy]
|
||||
before_action :check_manage_permissions, only: %i(create update destroy)
|
||||
before_action :check_manage_my_module_permissions, only: %i(create)
|
||||
|
||||
def create
|
||||
@tag = Tag.new(tag_params)
|
||||
|
@ -154,16 +153,12 @@ class TagsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def check_manage_my_module_permissions
|
||||
def check_manage_permissions
|
||||
my_module = MyModule.find_by id: params[:my_module_id]
|
||||
|
||||
render_403 if my_module && !can_manage_my_module_tags?(my_module)
|
||||
end
|
||||
|
||||
def check_manage_permissions
|
||||
render_403 unless can_manage_project_tags?(@project)
|
||||
end
|
||||
|
||||
def tag_params
|
||||
params.require(:tag).permit(:name, :color, :project_id)
|
||||
end
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if can_manage_project_tags?(@my_module.experiment.project) && can_manage_my_module_tags?(@my_module) %>
|
||||
<div class="pull-right create-new-tag-btn">
|
||||
<%= bootstrap_form_for [@my_module.experiment.project, @new_tag], remote: true, format: :json, html: { class: 'add-tag-form' } do |f| %>
|
||||
<%= hidden_field_tag :my_module_id, @my_module.id %>
|
||||
|
@ -80,5 +79,4 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue