Fix designated users permission check, fix project access modal [SCI-6480] (#3815)

This commit is contained in:
artoscinote 2022-02-11 10:46:00 +01:00 committed by GitHub
parent b9204e1ce3
commit a5888227f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 14 deletions

View file

@ -1,24 +1,18 @@
<% # frozen_string_literal: true %>
<div class="modal fade project-assignments-modal" tabindex="-1" role="dialog" data-action="modal-close">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content" id="user_assignments_modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><%= t '.title', resource_name: resource.name %></h4>
<h4 class="modal-title"><%= t '.title', resource_name: project.name %></h4>
</div>
<div class="modal-body">
<% resource.user_assignments.joins(:user).order('users.full_name': :asc).each do |user_assignment| %>
<%= render partial: 'access_permissions/partials/user_assignment', locals: { user_assignment: user_assignment, user: user_assignment.user, resource: resource } %>
<% end %>
</div>
<div class="modal-footer">
<% if can_manage_resource %>
<%= link_to new_access_permissions_project_path, class: 'btn btn-default pull-left', data: { action: 'swap-remote-container', target: '#user_assignments_modal' } do %>
<i class="fas fa-plus"></i>
<%= t '.new_resource_assignments', resource: resource.model_name.human.downcase %>
<% end %>
<% users.order(full_name: :asc).each do |user| %>
<% user_assignment = project.user_assignments.find_by(user: user) %>
<%= render partial: 'access_permissions/partials/user_assignment', locals: { user_assignment: user_assignment, user: user, resource: project } %>
<% end %>
<%= render('access_permissions/partials/default_public_user_role_form', project: project, editable: false) if project.visible? %>
</div>
</div>
</div>

View file

@ -4,7 +4,8 @@ json.modal controller.render_to_string(
partial: 'access_permissions/projects/modals/show_modal',
formats: [:html],
locals: {
resource: @project,
project: @project,
users: @project.manually_assigned_users,
can_manage_resource: can_manage_project_users?(@project)
},
layout: false

View file

@ -16,6 +16,6 @@
'data-users-create-url': my_module_user_my_modules_path(my_module_id: my_module.id),
'data-ajax-url': search_my_module_user_my_module_path(my_module),
'data-update-module-users-url': my_module_user_my_modules_url(my_module),
'data-view-mode': !can_manage_my_module?(my_module)
'data-view-mode': !can_manage_my_module_designated_users?(my_module)
} %>
</div>