sufia 6.6.1 → 6.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +2 -0
  3. data/.rubocop.yml +1 -0
  4. data/History.md +15 -2
  5. data/README.md +2 -2
  6. data/SUFIA_VERSION +1 -1
  7. data/app/assets/javascripts/sufia/permissions.js +43 -15
  8. data/app/controllers/concerns/sufia/collections_controller_behavior.rb +41 -5
  9. data/app/controllers/my/shared_collections_controller.rb +19 -0
  10. data/app/forms/sufia/forms/collection_edit_form.rb +8 -1
  11. data/app/helpers/batch_edits_helper.rb +1 -1
  12. data/app/helpers/collection_helper.rb +15 -0
  13. data/app/helpers/sufia/dashboard_helper_behavior.rb +4 -0
  14. data/app/helpers/sufia/permissions_helper.rb +2 -2
  15. data/app/helpers/sufia/sufia_helper_behavior.rb +2 -0
  16. data/app/presenters/sufia/collection_presenter.rb +1 -1
  17. data/app/search_builders/sufia/search_builder.rb +7 -0
  18. data/app/views/catalog/_search_form.html.erb +4 -0
  19. data/app/views/collections/_form.html.erb +5 -1
  20. data/app/views/collections/_permission_form.html.erb +111 -0
  21. data/app/views/collections/_show_document_list_row.html.erb +1 -1
  22. data/app/views/collections/show.html.erb +1 -1
  23. data/app/views/my/_sort_and_per_page.html.erb +1 -1
  24. data/app/views/my/index.html.erb +3 -0
  25. data/config/locales/sufia.en.yml +15 -10
  26. data/config/routes.rb +5 -1
  27. data/db/migrate/20160706132422_create_sufia_migration_survey_items.rb +12 -0
  28. data/{bin → exe}/audit_repository +0 -0
  29. data/exe/sufia_export +66 -0
  30. data/exe/sufia_survey +87 -0
  31. data/lib/generators/sufia/install_generator.rb +5 -0
  32. data/lib/sufia.rb +2 -0
  33. data/lib/sufia/export.rb +13 -0
  34. data/lib/sufia/export/actor.rb +98 -0
  35. data/lib/sufia/export/collection_converter.rb +20 -0
  36. data/lib/sufia/export/converter.rb +23 -0
  37. data/lib/sufia/export/generic_file_converter.rb +49 -0
  38. data/lib/sufia/export/permission_converter.rb +19 -0
  39. data/lib/sufia/export/version_converter.rb +30 -0
  40. data/lib/sufia/export/version_graph_converter.rb +35 -0
  41. data/lib/sufia/migration.rb +7 -0
  42. data/lib/sufia/migration/survey.rb +15 -0
  43. data/lib/sufia/migration/survey/fedora_id_service.rb +63 -0
  44. data/lib/sufia/migration/survey/item.rb +19 -0
  45. data/lib/sufia/migration/survey/surveyor.rb +21 -0
  46. data/lib/sufia/version.rb +1 -1
  47. data/spec/controllers/collections_controller_spec.rb +133 -17
  48. data/spec/factories/collection_factory.rb +28 -0
  49. data/spec/factories/generic_files.rb +34 -0
  50. data/spec/forms/collection_edit_form_spec.rb +1 -1
  51. data/spec/helpers/dashboard_helper_spec.rb +2 -0
  52. data/spec/helpers/sufia_helper_spec.rb +10 -1
  53. data/spec/lib/sufia/export/actor_spec.rb +118 -0
  54. data/spec/lib/sufia/export/collection_converter_spec.rb +40 -0
  55. data/spec/lib/sufia/export/generic_file_converter_spec.rb +47 -0
  56. data/spec/lib/sufia/export/permission_converter_spec.rb +19 -0
  57. data/spec/lib/sufia/export/version_converter_spec.rb +15 -0
  58. data/spec/lib/sufia/export/version_graph_converter_spec.rb +24 -0
  59. data/spec/lib/sufia/migration/survey_fedora_id_service_spec.rb +67 -0
  60. data/spec/lib/sufia/migration/survey_item_spec.rb +19 -0
  61. data/spec/lib/sufia/migration/surveyor_spec.rb +77 -0
  62. data/spec/models/collection_spec.rb +139 -14
  63. data/spec/routing/route_spec.rb +4 -0
  64. data/spec/views/collections/_form.html.erb_spec.rb +6 -5
  65. data/spec/views/collections/_permission_form.html.erb_spec.rb +45 -0
  66. data/sufia.gemspec +3 -2
  67. metadata +53 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75ebe5a7ba6376387d3c17bfa1f4faaf98d43bb5
4
- data.tar.gz: 313535cd837f9640ad3d5c0b2b1d26157d006c0b
3
+ metadata.gz: f55c1c825e448527062e1b637aa4e0db095b8d49
4
+ data.tar.gz: 5eb9af1ef450202b09bb95a9c5057b5b5a9766c4
5
5
  SHA512:
6
- metadata.gz: dccece1330a5ee29a1232710a63e31188f306ee4f6e1552e5e8522fa59a7bf420d2215f4b8a6ec3f96be5f8c53109fa9f01167a7a842d2967a517cfdab935bcf
7
- data.tar.gz: e489a1d9a56ad351fb46106e30e8818ce8d8930b703ea01efad2eb22afa870dcd7e0449de36563f8f6771d00a76a55cc5f743dd5d6ebe100f92cb1f754da0c54
6
+ metadata.gz: 6d733e7eb0f715bd7a630bd025667072ade7dda69603ad2ee619c78987230c35319ccce80776326bef2d2d1aa952cd1e0ed7e2ac8790110eb79ced13b28aff0e
7
+ data.tar.gz: d138503996cb6e03019bf20d988bba1ae0f13464d9255567bd99141c12041ba36ac229cb949c00d201a4d1f22b775051adc841bcaf2e85a1e231d7b87450c61a
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ enabled: false
@@ -51,6 +51,7 @@ Metrics/ModuleLength:
51
51
  Exclude:
52
52
  - 'app/controllers/concerns/sufia/users_controller_behavior.rb'
53
53
  - 'app/controllers/concerns/sufia/files_controller_behavior.rb'
54
+ - 'app/controllers/concerns/sufia/collections_controller_behavior.rb'
54
55
  - 'app/helpers/sufia/sufia_helper_behavior.rb'
55
56
 
56
57
  Style/BlockDelimiters:
data/History.md CHANGED
@@ -1,12 +1,25 @@
1
1
  # History of Sufia releases
2
- ## 6.6.1
2
+
3
+ ## 6.7.0
4
+ * Allow users and groups to share collections [E. Lynette Rayle]
5
+ * Don’t run hound on ruby code [E. Lynette Rayle]
6
+ * Add ability to set visibility for collections [E. Lynette Rayle]
7
+ * Adding executable to run surveyor from the command line. Changing surveyor to not recreate survey items for existing items when you run the executable multiple times. [Carolyn Cole]
8
+ * Adding a surveyor to create survey items for an id list And adding enumerator for migration status [Carolyn Cole]
9
+ * Adding FedoraIdService to create a list of all the ids (of classes we care about) in fedora [Carolyn Cole]
10
+ * Adding ActiveRecord class for Sufia::Migration::Survey::item [Carolyn Cole]
11
+ * Moving bin directory to exe to follow new standards [Carolyn Cole]
12
+ * Adding executable to run export actor from the command line [Carolyn Cole]
13
+ * Export Actor which will export ActiveFedora classes to json files [Carolyn Cole]
14
+ * Exporting a Collection's metadata, permissions, and members [Carolyn Cole]*
15
+
16
+ ## 6.6.1* Export GenericFile metdata, versions, and permissions [Carolyn Cole]
3
17
  * Upping the versions for 6.6.1 release [Carolyn Cole]
4
18
  * Removing group and login from profile update [Carolyn Cole]
5
19
  * Test with Rails 4.2.6 [Justin Coyne]
6
20
  * Add auto-fix + exclusions for new Rubocop violations [Michael J. Giarlo]
7
21
  * Temporarily pin Rubocop to get past broken 0.38.0 error [Michael J. Giarlo]
8
22
  * Hydra-Jetty should be the default service container in 6.x. [Michael J. Giarlo]
9
- * Escape property values before presenting them with auto_link. [Olli Lyytinen]
10
23
 
11
24
  ## 6.6.0
12
25
  * Update background workers doc [E. Lynette Rayle]
data/README.md CHANGED
@@ -95,7 +95,7 @@ If you have questions or need help, please email [the Hydra community tech list]
95
95
  # Creating a Sufia-based app
96
96
 
97
97
  This document contains instructions specific to setting up an app with __Sufia
98
- v6.6.0__. If you are looking for instructions on installing a different
98
+ v6.7.0__. If you are looking for instructions on installing a different
99
99
  version, be sure to select the appropriate branch or tag from the drop-down
100
100
  menu above.
101
101
 
@@ -147,7 +147,7 @@ rails new my_app
147
147
  Add the following lines to your application's Gemfile.
148
148
 
149
149
  ```
150
- gem 'sufia', '6.6.0'
150
+ gem 'sufia', '6.7.0'
151
151
  gem 'kaminari', github: 'jcoyne/kaminari', branch: 'sufia' # required to handle pagination properly in dashboard. See https://github.com/amatsuda/kaminari/pull/322
152
152
  ```
153
153
 
@@ -1 +1 @@
1
- 6.6.1
1
+ 6.7.0
@@ -77,15 +77,27 @@ Blacklight.onLoad(function() {
77
77
  // when user clicks on visibility, update potential access levels
78
78
  $("input[name='visibility']").on("change", set_access_levels);
79
79
 
80
- $('#generic_file_permissions_new_group_name').change(function (){
81
- var edit_option = $("#generic_file_permissions_new_group_permission option[value='edit']")[0];
82
- if (this.value.toUpperCase() == 'PUBLIC') {
83
- edit_option.disabled =true;
84
- } else {
85
- edit_option.disabled =false;
86
- }
87
-
88
- });
80
+ if (($("[id=new_collection]").length) || ($("[id^=edit_collection]")).length) {
81
+ $('#collection_permissions_new_group_name').change(function (){
82
+ var edit_option = $("#collection_permissions_new_group_permission option[value='edit']")[0];
83
+ if (this.value.toUpperCase() == 'PUBLIC') {
84
+ edit_option.disabled =true;
85
+ } else {
86
+ edit_option.disabled =false;
87
+ }
88
+ });
89
+ }
90
+ else {
91
+ $('#generic_file_permissions_new_group_name').change(function () {
92
+ var edit_option = $("#generic_file_permissions_new_group_permission option[value='edit']")[0];
93
+ if (this.value.toUpperCase() == 'PUBLIC') {
94
+ edit_option.disabled = true;
95
+ } else {
96
+ edit_option.disabled = false;
97
+ }
98
+
99
+ });
100
+ }
89
101
 
90
102
  function addPerm(agent_name, access, access_label, agent_type)
91
103
  {
@@ -114,7 +126,11 @@ Blacklight.onLoad(function() {
114
126
  }
115
127
 
116
128
  function addHiddenPermField(element, type, name, access) {
117
- var prefix = 'generic_file[permissions_attributes][' + nextIndex() + ']';
129
+ var prefix = 'generic_file';
130
+ if (($("[id=new_collection]").length) || ($("[id^=edit_collection]").length)) {
131
+ prefix = 'collection';
132
+ }
133
+ prefix += '[permissions_attributes][' + nextIndex() + ']';
118
134
  $('<input>').attr({
119
135
  type: 'hidden',
120
136
  name: prefix + '[type]',
@@ -145,13 +161,17 @@ Blacklight.onLoad(function() {
145
161
  });
146
162
 
147
163
  function showPermissionNote() {
148
- $('#save_perm_note').removeClass('hidden');
164
+ $('#save_perm_note').removeClass('hidden');
149
165
  }
150
166
 
151
167
  function addDestroyField(element, index) {
168
+ var prefix = 'generic_file';
169
+ if (($("[id=new_collection]").length) || ($("[id^=edit_collection]").length)) {
170
+ prefix = 'collection';
171
+ }
152
172
  $('<input>').attr({
153
173
  type: 'hidden',
154
- name: 'generic_file[permissions_attributes][' + index + '][_destroy]',
174
+ name: prefix + '[permissions_attributes][' + index + '][_destroy]',
155
175
  value: 'true'
156
176
  }).appendTo(element);
157
177
  }
@@ -169,6 +189,10 @@ function get_visibility() {
169
189
  * visibility of Open or Institution) so disable the Read option
170
190
  */
171
191
  function set_access_levels() {
192
+ var permissions_fld = 'generic_file[permissions]';
193
+ if (($("[id=new_collection]").length) || ($("[id^=edit_collection]").length)) {
194
+ permissions_fld = 'collection[permissions]';
195
+ }
172
196
  var vis = get_visibility();
173
197
  var enabled_disabled = false;
174
198
  if (vis == "open" || vis == "psu") {
@@ -176,7 +200,7 @@ function set_access_levels() {
176
200
  }
177
201
  $('#new_group_permission_skel option[value=read]').attr("disabled", enabled_disabled);
178
202
  $('#new_user_permission_skel option[value=read]').attr("disabled", enabled_disabled);
179
- var perms_sel = $("select[name^='generic_file[permissions]']");
203
+ var perms_sel = $("select[name^=permissions_fld]");
180
204
  $.each(perms_sel, function(index, sel_obj) {
181
205
  $.each(sel_obj, function(j, opt) {
182
206
  if( opt.value == "read") {
@@ -192,10 +216,14 @@ function set_access_levels() {
192
216
  */
193
217
  function is_permission_duplicate(user_or_group_name)
194
218
  {
219
+ var permissions_fld = 'generic_file[permissions]';
220
+ if (($("[id=new_collection]").length) || ($("[id^=edit_collection]").length)) {
221
+ permissions_fld = 'collection[permissions]';
222
+ }
195
223
  s = "[" + user_or_group_name + "]";
196
224
  var patt = new RegExp(preg_quote(s), 'gi');
197
- var perms_input = $("input[name^='generic_file[permissions]']");
198
- var perms_sel = $("select[name^='generic_file[permissions]']");
225
+ var perms_input = $("input[name^=permissions_fld]");
226
+ var perms_sel = $("select[name^=permissions_fld]");
199
227
  var flag = 1;
200
228
  perms_input.each(function(index, form_input) {
201
229
  // if the name is already being used - return false (not valid)
@@ -6,6 +6,18 @@ module Sufia
6
6
  included do
7
7
  include Sufia::Breadcrumbs
8
8
 
9
+ # Catch permission errors
10
+ rescue_from Hydra::AccessDenied, CanCan::AccessDenied do |exception|
11
+ if exception.action == :edit
12
+ redirect_to(sufia.url_for(action: 'show'), alert: "You do not have sufficient privileges to edit this document")
13
+ elsif current_user && current_user.persisted?
14
+ redirect_to root_url, alert: exception.message
15
+ else
16
+ session["user_return_to"] = request.url
17
+ redirect_to new_user_session_url, alert: exception.message
18
+ end
19
+ end
20
+
9
21
  before_action :filter_docs_with_read_access!, except: :show
10
22
  before_action :has_access?, except: :show
11
23
  before_action :build_breadcrumbs, only: [:edit, :show]
@@ -17,6 +29,7 @@ module Sufia
17
29
 
18
30
  def new
19
31
  super
32
+ @collection.visibility = 'open' # default to open access
20
33
  form
21
34
  end
22
35
 
@@ -56,11 +69,25 @@ module Sufia
56
69
 
57
70
  def collection_params
58
71
  form_class.model_attributes(
59
- params.require(:collection).permit(:title, :description, :members, part_of: [],
60
- contributor: [], creator: [], publisher: [], date_created: [], subject: [],
61
- language: [], rights: [], resource_type: [], identifier: [], based_near: [],
62
- tag: [], related_url: [])
63
- )
72
+ params.require(:collection).permit(
73
+ :title,
74
+ :description,
75
+ :members,
76
+ part_of: [],
77
+ contributor: [],
78
+ creator: [],
79
+ publisher: [],
80
+ date_created: [],
81
+ subject: [],
82
+ language: [],
83
+ rights: [],
84
+ resource_type: [],
85
+ identifier: [],
86
+ based_near: [],
87
+ tag: [],
88
+ related_url: []).merge(params.permit(:visibility)).tap do |whitelisted|
89
+ whitelisted[:permissions_attributes] = params[:collection][:permissions_attributes]
90
+ end)
64
91
  end
65
92
 
66
93
  def query_collection_members
@@ -94,5 +121,14 @@ module Sufia
94
121
  Sufia.queue.push(ResolrizeGenericFileJob.new(gf))
95
122
  end
96
123
  end
124
+
125
+ def permissions_attributes
126
+ begin
127
+ perm_attrs = ActionController::Parameters.new(permissions_attributes: params.require(:collection).require(:permissions_attributes))
128
+ rescue
129
+ perm_attrs = ActionController::Parameters.new
130
+ end
131
+ perm_attrs
132
+ end
97
133
  end
98
134
  end
@@ -0,0 +1,19 @@
1
+ module My
2
+ class SharedCollectionsController < MyController
3
+ self.search_params_logic += [
4
+ :show_only_shared_collections,
5
+ :show_only_collections
6
+ ]
7
+
8
+ def index
9
+ super
10
+ @selected_tab = :shared_collections
11
+ end
12
+
13
+ protected
14
+
15
+ def search_action_url(*args)
16
+ sufia.dashboard_shared_collections_url(*args)
17
+ end
18
+ end
19
+ end
@@ -2,9 +2,16 @@ module Sufia
2
2
  module Forms
3
3
  class CollectionEditForm
4
4
  include HydraEditor::Form
5
+ include HydraEditor::Form::Permissions
6
+
5
7
  self.model_class = ::Collection
6
8
  self.terms = [:resource_type, :title, :creator, :contributor, :description, :tag, :rights,
7
- :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url]
9
+ :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url, :visibility]
10
+
11
+ # Remove visibility from the set of rendered terms
12
+ def rendered_terms
13
+ terms - [:visibility]
14
+ end
8
15
 
9
16
  # Test to see if the given field is required
10
17
  # @param [Symbol] key a field
@@ -6,6 +6,6 @@ module BatchEditsHelper
6
6
  end
7
7
 
8
8
  def render_check_all
9
- render partial: 'batch_edits/check_all' unless params[:controller] =~ /my\/collections/
9
+ render partial: 'batch_edits/check_all' unless params[:controller] =~ /my\/.*collections/
10
10
  end
11
11
  end
@@ -0,0 +1,15 @@
1
+ # -*- coding: utf-8 -*-
2
+ module CollectionHelper
3
+ def render_collection_visibility_badge
4
+ if can? :edit, @collection
5
+ render_collection_visibility_link(@collection)
6
+ else
7
+ render_visibility_label(@collection)
8
+ end
9
+ end
10
+
11
+ def render_collection_visibility_link(collection)
12
+ link_to render_visibility_label(collection), collections.edit_collection_path(collection, anchor: "permissions_display"),
13
+ id: "permission_" + collection.id, class: "visibility-link"
14
+ end
15
+ end
@@ -40,6 +40,10 @@ module Sufia
40
40
  params[:controller].match(/^my\/files/)
41
41
  end
42
42
 
43
+ def on_my_shared_files?
44
+ params[:controller].match(/^my\/shares/)
45
+ end
46
+
43
47
  def number_of_files(user = current_user)
44
48
  ::GenericFile.where(Solrizer.solr_name('depositor', :symbol) => user.user_key).count
45
49
  end
@@ -1,11 +1,11 @@
1
1
  module Sufia
2
2
  module PermissionsHelper
3
3
  def visibility_help
4
- help_link('generic_files/visibility', 'Visibility', 'Useage information for visibility')
4
+ help_link('generic_files/visibility', 'Visibility', 'Usage information for visibility')
5
5
  end
6
6
 
7
7
  def share_with_help
8
- help_link('generic_files/share_with', 'Share With', 'Useage information for sharing')
8
+ help_link('generic_files/share_with', 'Share With', 'Usage information for sharing')
9
9
  end
10
10
 
11
11
  private
@@ -209,6 +209,8 @@ module Sufia
209
209
  sufia.dashboard_shares_path
210
210
  when "my/highlights"
211
211
  sufia.dashboard_highlights_path
212
+ when "my/shared_collections"
213
+ sufia.dashboard_shared_collections_path
212
214
  else
213
215
  sufia.dashboard_files_path
214
216
  end
@@ -11,7 +11,7 @@ module Sufia
11
11
 
12
12
  # Depositor and permissions are not displayed in app/views/collections/_show_descriptions.html.erb
13
13
  # so don't include them in `terms'.
14
- # delegate :depositor, :permissions, to: :model
14
+ delegate :depositor, :permissions, to: :model
15
15
 
16
16
  def terms_with_values
17
17
  terms.select { |t| self[t].present? }
@@ -9,6 +9,13 @@ module Sufia::SearchBuilder
9
9
  ]
10
10
  end
11
11
 
12
+ def show_only_shared_collections(solr_parameters)
13
+ solr_parameters[:fq] ||= []
14
+ solr_parameters[:fq] += [
15
+ "-" + ActiveFedora::SolrQueryBuilder.construct_query_for_rel(depositor: scope.current_user.user_key)
16
+ ]
17
+ end
18
+
12
19
  def show_only_resources_deposited_by_current_user(solr_parameters)
13
20
  solr_parameters[:fq] ||= []
14
21
  solr_parameters[:fq] += [
@@ -40,6 +40,10 @@
40
40
  <%= link_to t("sufia.search.form.option.my_shares.label_long"), "#",
41
41
  data: { "search-option" => sufia.dashboard_shares_path, "search-label" => t("sufia.search.form.option.my_shares.label_short") } %>
42
42
  </li>
43
+ <li>
44
+ <%= link_to t("sufia.search.form.option.my_shared_collections.label_long"), "#",
45
+ data: { "search-option" => sufia.dashboard_shared_collections_path, "search-label" => t("sufia.search.form.option.my_shared_collections.label_short") } %>
46
+ </li>
43
47
  <% end %>
44
48
 
45
49
  </ul>
@@ -2,7 +2,7 @@
2
2
  <div id="descriptions_display">
3
3
  <h2 class="non lower">Descriptions <small class="pull-right"><span class="error">*</span> indicates required fields</small> </h2>
4
4
  <div class="well">
5
- <% f.object.terms.each do |term| %>
5
+ <% f.object.rendered_terms.each do |term| %>
6
6
  <%= render_edit_field_partial term, f: f %>
7
7
  <% end %>
8
8
  </div><!-- /well -->
@@ -14,6 +14,10 @@
14
14
  <% end %>
15
15
  <% end %>
16
16
 
17
+ <div class="collection_form_visibility">
18
+ <%= render 'permission_form', f: f.object %>
19
+ </div>
20
+
17
21
  <div class="primary-actions">
18
22
  <% if params[:action] == "new" %>
19
23
  <%= f.submit 'Create Collection', class: 'btn btn-primary', onclick: "confirmation_needed = false;", id: "create_submit", name: "create_collection" %>
@@ -0,0 +1,111 @@
1
+ <% depositor = f.model.depositor || current_user %>
2
+
3
+ <div class="alert alert-info hidden" id="save_perm_note">Permissions are <strong>not</strong> saved until the &quot;Save&quot; button is pressed at the bottom of the page.</div>
4
+ <div class="alert alert-warning hidden" id="permissions_error">
5
+ <a class="close" data-dismiss="alert" href="#">
6
+ <span class="sr-only">Close this alert</span>
7
+ <span aria-hidden="true">×</span>
8
+ </a>
9
+ <span id="permissions_error_text"></span></div>
10
+
11
+ <div class="well">
12
+
13
+ <h3>Visibility - <small>who should have the ability to read and download</small>
14
+ <span id="visibility_tooltip" class="h5"><%= visibility_help %></span>
15
+ </h3>
16
+ <div class="radio">
17
+ <label>
18
+ <input type="radio" id="visibility_open" name="visibility" value="<%=Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC %>" <% if f.model.public? %> checked="true"<% end %>/> <span class="label label-success">Open Access</span> Visible to the world.
19
+ </label>
20
+ <label>
21
+ <input type="radio" id="visibility_psu" name="visibility" value="<%=Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED %>" <% if f.model.registered? %> checked="true"<% end %> /><span class="label label-info"><%=t('sufia.institution_name') %></span> Visible to all <%=t('sufia.institution_name') %> users.
22
+ </label>
23
+ <label>
24
+ <input type="radio" id="visibility_restricted" name="visibility" value="<%=Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE %>"<% if f.model.private? %> checked="true"<% end %> /> <span class="label label-danger">Private</span> Visible to users/groups specified below, if any.
25
+ </label>
26
+ </div>
27
+
28
+ <!-- Share With -->
29
+ <div class="row">
30
+ <h3 class="col-sm-12">Share With <small>(optional)</small>
31
+ <span id="share_with_tooltip" class="h5"><%= share_with_help %></span>
32
+ </h3>
33
+ </div>
34
+
35
+ <div class="form-group row">
36
+ <div id="new-user">
37
+ <p class="col-sm-12">Enter <%=t('sufia.account_label') %> (one at a time)</p>
38
+ <p class="sr-only">Use the add button to give access to one <%=t('sufia.account_label') %> at a time (it will be added to the list below). Select the user, by name or <%=t('sufia.account_label') %>. Then select the access level you wish to grant and click on Add this <%= t('sufia.account_label') %> to complete adding the permission.</p>
39
+ <div class="col-sm-5">
40
+ <label for="new_user_name_skel" class="sr-only"><%= t('sufia.account_label') %> (without the <%= t('sufia.directory.suffix') %> part)</label>
41
+ <%= text_field_tag 'new_user_name_skel', nil %>
42
+ </div>
43
+ <div class="col-sm-4">
44
+ <label for="new_user_permission_skel" class="sr-only">Access type to grant</label>
45
+ <%= select_tag 'new_user_permission_skel', options_for_select(Sufia.config.permission_levels), class: 'form-control' %>
46
+ </div>
47
+ <div class="col-sm-3">
48
+ <button class="btn btn-mini btn-inverse" id="add_new_user_skel">
49
+ <span class="sr-only">Add this <%= t('sufia.account_label') %></span>
50
+ <span aria-hidden="true"><i class="glyphicon glyphicon-plus"></i></span>
51
+ </button>
52
+ <br /> <span id="directory_user_result"></span>
53
+ </div>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="form-group row">
58
+ <div id="new-group" >
59
+ <p class="sr-only">Use the add button to give access to one group at a time (it will be added to the list below).</p>
60
+ <div class="col-sm-5">
61
+ <label for="new_group_name_skel" class="sr-only">Group</label>
62
+ <%= select_tag 'new_group_name_skel', options_for_select(["Select a group"] + current_user.groups), class: 'form-control' %>
63
+ </div>
64
+ <div class="col-sm-4">
65
+ <label for="new_group_permission_skel" class="sr-only">Access type to grant</label>
66
+ <%= select_tag 'new_group_permission_skel', options_for_select(Sufia.config.permission_levels), class: 'form-control' %>
67
+ </div>
68
+ <div class="col-sm-3">
69
+ <span class="sr-only">Add this group</span>
70
+ <button class="btn btn-mini btn-inverse" id="add_new_group_skel"><i class="glyphicon glyphicon-plus"></i></button>
71
+ <br /><span id="directory_group_result"></span>
72
+ </div>
73
+ </div>
74
+ </div>
75
+
76
+ </div><!-- /.well -->
77
+
78
+ <table class="table table-bordered">
79
+ <tr>
80
+ <th width="60%">Person/Group</th>
81
+ <th width="40%">Access Level</th>
82
+ </tr>
83
+ <tr id="file_permissions">
84
+ <td>
85
+ <%= label_tag :owner_access, class: "control-label" do %>
86
+ Depositor (<span id="file_owner" data-depositor="<%= depositor %>"><%= link_to_profile depositor %></span>)
87
+ <% end %>
88
+ </td>
89
+ <td>
90
+ <%= Sufia.config.owner_permission_levels.keys[0] %>
91
+ </td>
92
+ </tr>
93
+ <% x=1 %>
94
+ <% f.model.permissions.each do |permission_fields| %>
95
+ <%# skip the public, penn state (aka registered), and depositor perms as they are displayed first at the top %>
96
+ <% next if ['public', 'registered', depositor].include? permission_fields.agent_name.downcase %>
97
+ <tr>
98
+ <td><%= label_tag :owner_access, class: "control-label" do %>
99
+ <%= user_display_name_and_key(permission_fields.agent_name) %>
100
+ <% end %></td>
101
+ <td>
102
+ <div class="col-sm-8">
103
+ <%= select_tag "collection[permissions_attributes][#{x}][access]", options_for_select(Sufia.config.permission_levels, permission_fields.access), class: 'form-control select_perm', id: "collection_permission_attributes_#{x}_access" %>
104
+ </div>
105
+ <button class="btn close remove_perm" data-index="<%= x %>">X</button>
106
+ </td>
107
+ </tr>
108
+ <%= hidden_field_tag "collection[permissions_attributes][#{x}][id]", permission_fields.id, id: "collection_permission_attributes_#{x}_id" %>
109
+ <% x+=1 %>
110
+ <% end %>
111
+ </table>