:ruby
  user_is_maintainer = User.possibly_nobody.can_modify?(package || project)
  data = { 'project' => project.name }
  if package
    data['save-user'] = package_save_person_url
    data['remove'] = package_remove_role_url
    data['save-group'] = package_save_group_path
    data['package'] = package.name
  else
    data['save-user'] = project_save_person_url
    data['remove'] = project_remove_role_url
    data['save-group'] = project_save_group_path
  end

#involved-users{ data: data }
  %h3 User Roles
  - if users.present?
    %table.responsive.table.table-sm.table-bordered.table-hover.w-100#user-table
      %thead
        %tr
          %td Username
          - roles.each do |role|
            %td= role.title.capitalize
          - if User.session
            %td
      %tbody
        = render partial: 'webui/shared/user_or_groups_roles/list',
                 locals: { records: users, roles: roles, type: 'user',
                           user_is_maintainer: user_is_maintainer,
                           project: project, package: package }
  - else
    %p
      %i There are no users...

  - if user_is_maintainer
    .pt-4
      = render(partial: 'webui/shared/user_or_groups_roles/add_user_dialog', locals: { project: project.to_param, package: package.to_param })
      = link_to('#', data: { 'bs-toggle': 'modal', 'bs-target': '#add-user-role-modal' }, id: 'add-user') do
        %i.fas.fa-plus-circle.text-primary
        Add User
      = render DeleteConfirmationDialogComponent.new(modal_id: 'delete-role-modal', method: :post)

  %hr

  %h3 Group Roles
  - if groups.present?
    %table.responsive.table.table-sm.table-bordered.table-hover.w-100#group-table
      %thead
        %tr
          %td Group name
          - roles.each do |role|
            %td= role.title.capitalize
          - if User.session
            %td
      %tbody
        = render partial: 'webui/shared/user_or_groups_roles/list',
                 locals: { records: groups, roles: roles, type: 'group',
                           user_is_maintainer: user_is_maintainer,
                           project: project, package: package }
  - else
    %p
      %i There are no groups...

  - if user_is_maintainer
    .pt-4
      = render(partial: 'webui/shared/user_or_groups_roles/add_group_dialog', locals: { project: project.to_param, package: package.to_param })
      = link_to('#', data: { 'bs-toggle': 'modal', 'bs-target': '#add-group-role-modal' }, id: 'add-group') do
        %i.fas.fa-plus-circle.text-primary
        Add Group

:javascript
  setDataTableForUsersAndGroups();
- if user_is_maintainer
  :javascript
    $(document).ready(function() {
      $(document).on('click','.trigger', function() {
        changeUserRole($(this));
      });
    });
