3 [@users, @groups].each do |obj_list|
4 obj_list.each { |o| uuid_map[o.uuid] = o }
6 perm_name_desc_map = {}
7 perm_desc_name_map = {}
9 ['Read', 'Write', 'Manage'].each do |link_desc|
10 link_name = "can_#{link_desc.downcase}"
11 perm_name_desc_map[link_name] = link_desc
12 perm_desc_name_map[link_desc] = link_name
13 perms_json << {value: link_name, text: link_desc}
15 perms_json = perms_json.to_json
17 "groups" => [["group_class", "=", nil]],
19 choose_filters.default = []
20 owner_icon = fa_icon_class_for_uuid(@object.owner_uuid)
21 if owner_icon == "fa-users"
22 owner_icon = "fa-folder"
23 owner_type = "parent project"
25 owner_type = "owning user"
29 <div class="pull-right">
30 <% ["users", "groups"].each do |share_class| %>
32 <%= link_to(send("choose_#{share_class}_path",
33 title: "Share with #{share_class}",
38 filters: choose_filters[share_class].to_json,
39 action_method: 'post',
40 action_href: share_with_project_path,
42 action_data: {selection_param: 'uuids[]', success: 'tab-refresh'}.to_json),
43 class: "btn btn-primary btn-sm", remote: true, method: 'get') do %>
44 <i class="fa fa-fw fa-plus"></i> Share with <%= share_class %>…
50 <p>Permissions for this project are inherited from the <%= owner_type %>
51 <i class="fa fa-fw <%= owner_icon %>"></i>
52 <%= link_to_if_arvados_object @object.owner_uuid, friendly_name: true %>.
55 <table id="project_sharing" class="topalign table" style="clear: both; margin-top: 1em;">
57 <th>User/Group Name</th>
58 <th colspan="2">Project Access</th>
61 <% @share_links.andand.each do |link|
62 shared_with = uuid_map[link.tail_uuid]
64 link_name = link.tail_uuid
65 elsif shared_with.respond_to?(:full_name)
66 link_name = shared_with.full_name
68 link_name = shared_with.name
70 <tr data-object-uuid="<%= link.uuid %>">
72 <i class="fa fa-fw <%= fa_icon_class_for_uuid(link.tail_uuid) %>"></i>
73 <%= link_to_if_arvados_object(link.tail_uuid, link_text: link_name) %>
75 <td><%= link_to perm_name_desc_map[link.name], '#', {
76 "data-emptytext" => "Read",
77 "data-placement" => "bottom",
78 "data-type" => "select",
79 "data-url" => url_for(action: "update", id: link.uuid, controller: "links", merge: true),
80 "data-title" => "Set #{link_name}'s access level",
81 "data-name" => "[name]",
82 "data-pk" => {id: link.tail_uuid, key: "link"}.to_json,
83 "data-value" => link.name,
84 "data-clear" => false,
85 "data-source" => perms_json,
86 "data-tpl" => "<select id=\"share_change_level\"></select>",
87 "class" => "editable form-control",
92 {action: 'destroy', id: link.uuid, controller: "links"},
93 {title: 'Revoke', class: 'btn btn-default btn-nodecorate', method: :delete,
94 data: {confirm: "Revoke #{link_name}'s access to this project?",
96 <i class="fa fa-fw fa-trash-o"></i>