mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-19 05:13:00 +08:00
SCI-4674 name permissions more properly
This commit is contained in:
parent
5f195b3622
commit
77e1feda97
3 changed files with 8 additions and 8 deletions
app
controllers
permissions
views/my_modules/repositories
|
@ -36,7 +36,7 @@ class MyModuleRepositorySnapshotsController < ApplicationController
|
|||
render json: {
|
||||
html: render_to_string(partial: 'my_modules/repositories/full_view_version',
|
||||
locals: { repository_snapshot: repository_snapshot,
|
||||
can_delete_snapshot: can_manage_repository_snapshots?(@my_module) })
|
||||
can_delete_snapshot: can_manage_my_module_repository_snapshots?(@my_module) })
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -50,7 +50,7 @@ class MyModuleRepositorySnapshotsController < ApplicationController
|
|||
render json: {
|
||||
html: render_to_string(partial: 'my_modules/repositories/full_view_version',
|
||||
locals: { repository_snapshot: @repository_snapshot,
|
||||
can_delete_snapshot: can_manage_repository_snapshots?(@my_module) })
|
||||
can_delete_snapshot: can_manage_my_module_repository_snapshots?(@my_module) })
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -124,6 +124,6 @@ class MyModuleRepositorySnapshotsController < ApplicationController
|
|||
end
|
||||
|
||||
def check_manage_permissions
|
||||
render_403 unless can_manage_repository_snapshots?(@my_module)
|
||||
render_403 unless can_manage_my_module_repository_snapshots?(@my_module)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -116,12 +116,12 @@ Canaid::Permissions.register_for(MyModule) do
|
|||
end
|
||||
|
||||
# module: create a snapshot of repository item
|
||||
can :create_repository_snapshot do |user, my_module|
|
||||
can :create_my_module_repository_snapshot do |user, my_module|
|
||||
user.is_technician_or_higher_of_project?(my_module.experiment.project)
|
||||
end
|
||||
|
||||
# module: make a repository snapshot selected
|
||||
can :manage_repository_snapshots do |user, my_module|
|
||||
can :manage_my_module_repository_snapshots do |user, my_module|
|
||||
user.is_technician_or_higher_of_project?(my_module.experiment.project)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @repository.present? && live_items_present && can_create_repository_snapshot?(@my_module) %>
|
||||
<% if @repository.present? && live_items_present && can_create_my_module_repository_snapshot?(@my_module) %>
|
||||
<div class="create-snapshot-item">
|
||||
<p class="info <%= 'hidden' unless @repository_snapshots.blank? %>">
|
||||
<%= t('my_modules.repository.snapshots.full_view.no_snapshots_label') %>
|
||||
|
@ -48,11 +48,11 @@
|
|||
<%= render partial: 'my_modules/repositories/full_view_version',
|
||||
collection: @repository_snapshots,
|
||||
as: :repository_snapshot,
|
||||
locals: { can_delete_snapshot: can_manage_repository_snapshots?(@my_module) } %>
|
||||
locals: { can_delete_snapshot: can_manage_my_module_repository_snapshots?(@my_module) } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if can_manage_repository_snapshots(@my_module) %>
|
||||
<% if can_manage_my_module_repository_snapshots(@my_module) %>
|
||||
<div class="list-group-item text-center hidden">
|
||||
<a id="setDefaultVersionButton" class="btn btn-primary default-version-button" data-select-path="<%= my_module_select_default_snapshot_path(@my_module) %>">
|
||||
<%= t('my_modules.repository.snapshots.full_view.set_default_button') %>
|
||||
|
|
Loading…
Reference in a new issue