4 [User, Group].each do |type|
6 .filter([['uuid','in',@share_links.collect(&:tail_uuid)]])
12 perm_name_desc_map = {}
13 perm_desc_name_map = {}
15 ['Read', 'Write', 'Manage'].each do |link_desc|
16 link_name = "can_#{link_desc.downcase}"
17 perm_name_desc_map[link_name] = link_desc
18 perm_desc_name_map[link_desc] = link_name
19 perms_json << {value: link_name, text: link_desc}
21 perms_json = perms_json.to_json
23 "groups" => [["group_class", "=", "role"]],
25 choose_filters.default = []
26 owner_icon = fa_icon_class_for_uuid(@object.owner_uuid)
27 if owner_icon == "fa-users"
28 owner_icon = "fa-folder"
29 owner_type = "parent project"
31 owner_type = "owning user"
35 <div class="pull-right">
36 <% ["users", "groups"].each do |share_class| %>
38 <%= link_to(send("choose_#{share_class}_path",
39 title: "Share with #{share_class}",
43 filters: choose_filters[share_class].to_json,
44 action_method: 'post',
45 action_href: share_with_project_path,
47 action_data: {selection_param: 'uuids[]', success: 'tab-refresh'}.to_json),
48 class: "btn btn-primary btn-sm", remote: true) do %>
49 <i class="fa fa-fw fa-plus"></i> Share with <%= share_class %>…
55 <p>Permissions for this project are inherited from the <%= owner_type %>
56 <i class="fa fa-fw <%= owner_icon %>"></i>
57 <%= link_to_if_arvados_object @object.owner_uuid, friendly_name: true %>.
60 <table id="project_sharing" class="topalign table" style="clear: both; margin-top: 1em;">
62 <th>User/Group Name</th>
63 <th>Email Address</th>
64 <th colspan="2">Project Access</th>
67 <% @share_links.andand.each do |link|
68 shared_with = uuid_map[link.tail_uuid]
70 link_name = link.tail_uuid
71 elsif shared_with.respond_to?(:full_name)
72 link_name = shared_with.full_name
74 link_name = shared_with.name
76 if shared_with && shared_with.respond_to?(:email)
77 email = shared_with.email
80 <tr data-object-uuid="<%= link.uuid %>">
82 <i class="fa fa-fw <%= fa_icon_class_for_uuid(link.tail_uuid) %>"></i>
83 <%= link_to_if_arvados_object(link.tail_uuid, link_text: link_name) %>
88 <td><%= link_to perm_name_desc_map[link.name], '#', {
89 "data-emptytext" => "Read",
90 "data-placement" => "bottom",
91 "data-type" => "select",
92 "data-url" => url_for(action: "update", id: link.uuid, controller: "links", merge: true),
93 "data-title" => "Set #{link_name}'s access level",
94 "data-name" => "[name]",
95 "data-pk" => {id: link.tail_uuid, key: "link"}.to_json,
96 "data-value" => link.name,
97 "data-clear" => false,
98 "data-source" => perms_json,
99 "data-tpl" => "<select id=\"share_change_level\"></select>",
100 "class" => "editable form-control",
105 {action: 'destroy', id: link.uuid, controller: "links"},
106 {title: 'Revoke', class: 'btn btn-default btn-nodecorate', method: :delete,
107 data: {confirm: "Revoke #{link_name}'s access to this project?",
108 remote: true}}) do %>
109 <i class="fa fa-fw fa-trash-o"></i>