Project card permission with not assigned team admin [SCI-8727]

This commit is contained in:
Giga Chubinidze 2023-07-07 07:06:43 +04:00
parent 71e5c81f8b
commit e1ab7bda4b
2 changed files with 107 additions and 91 deletions

View file

@ -13,6 +13,7 @@ module Toolbars
@project_folders = current_user.current_team.project_folders.where(id: project_folder_ids)
@items = @projects + @project_folders
@not_assigned = @projects.any? { |project| !project.assigned_users.include?(current_user) }
@single = @items.length == 1
@ -29,6 +30,7 @@ module Toolbars
def actions
return [] if @item_type == :none
return [access_action] if @not_assigned
[
restore_action,

View file

@ -3,7 +3,11 @@
<% project_form = f %>
<%= f.hidden_field :archived, value: !project.archived %>
<% end %>
<% assigned = project.assigned_users.include?(current_user) %>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="projectActionsDropdown">
<% if assigned %>
<!-- Restore project -->
<% if project.archived? && can_restore_project?(project) %>
<li class="form-dropdown-item">
@ -97,4 +101,14 @@
<span><%= t('projects.index.activities_option') %></span>
</a>
</li>
<% else %>
<!-- Project members access -->
<li class="form-dropdown-item">
<%= link_to can_manage_project_users?(project) ? edit_access_permissions_project_path(project) : access_permissions_project_path(project),
data: { action: 'remote-modal'} do %>
<i class="sn-icon sn-icon-project-member-access"></i>
<%= I18n.t('projects.index.project_members_access') %>
<% end %>
</li>
<% end %>
</ul>