Skip to content
This repository was archived by the owner on Mar 18, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/assets/stylesheets/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,12 @@ $link-blue: #0000cc;
padding-left: 0;
padding-right: 0;
}
#transfer-notice {
padding: 10px;
font-size: 2.0rem;
color: white;
background-color: $hokie-maroon;
a, a:hover, a:visited {
color: white;
}
}
7 changes: 7 additions & 0 deletions app/controllers/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def show
def new
super
flash[:notice] = nil
redirect_to root_path, alert: "Sorry, you are not authorized to view that page" if (current_user.blank? || !current_user.admin?)

end

def after_create
Expand Down Expand Up @@ -77,6 +79,11 @@ def create
end
end

def edit
super
redirect_to root_path, alert: "Sorry, you are not authorized to view that page" if (current_user.blank? || !current_user.admin?)
end

def update
process_member_changes
if @collection.update(collection_params.except(:members))
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
class DashboardController < ApplicationController
include Sufia::DashboardControllerBehavior

before_action :non_admin_redirect

def admin_metadata_download
Sufia.queue.push(AdminMetadataExportJob.new(request.base_url, current_user))
redirect_to sufia.dashboard_index_path, notice: 'Your export is running in the background. You should receive an email when it is complete.'
end

def non_admin_redirect
redirect_to root_path, alert: "Sorry, you are not authorized to view that page" if (current_user.blank? || !current_user.admin?)
end
end
6 changes: 6 additions & 0 deletions app/controllers/generic_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class GenericFilesController < ApplicationController

def edit
super
redirect_to root_path, alert: "Sorry, you are not authorized to view that page" if (current_user.blank? || !current_user.admin?)
unless current_user.admin?
self.edit_form_class.terms -= [:provenance]
@provenance_display = "records/show_fields/provenance"
Expand Down Expand Up @@ -37,4 +38,9 @@ def update
end
end

def new
super
redirect_to root_path, alert: "Sorry, you are not authorized to view that page" if (current_user.blank? || !current_user.admin?)
end

end
4 changes: 2 additions & 2 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ def custom_permissions
# can [:create], ActiveFedora::Base
# end
ezid_shoulder = Rails.application.secrets['doi']['default_shoulder']
cannot [:update, :destroy], ::Collection do |c|
cannot [:create, :update, :destroy], ::Collection do |c|
c.identifier.any? { |identifier| !identifier.blank? }
end unless admin_user?

cannot [:update, :destroy], ::GenericFile do |g_f|
cannot [:create, :update, :destroy], ::GenericFile do |g_f|
g_f.collections.any? { |c| c.identifier.any? { |identifier| !identifier.blank? } }
end unless admin_user?

Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/homepage.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<div id="page-positioner">
<%= render partial: '/masthead' %>
<div id="center-wrapper" class="col-xs-11 col-centered">
<div id="transfer-notice">To publish a dataset on VTechData please contact <a href="mailto:vtechdata@vt.edu">vtechdata@vt.edu</a>. The ability to create and edit data on VTechData is restricted as we move to a new repository platform.</div>
<%= render partial: '/logo_title_row' %>

<%= render partial: '/homepage/home_content_welcome' %>
Expand Down
3 changes: 2 additions & 1 deletion app/views/layouts/sufia-dashboard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<a href="#skip_to_content" class="sr-only">Skip to Content</a>
<%= render partial: '/masthead' %>
<div id="center-wrapper" class="col-xs-11 col-centered">
<%= render partial: '/logo_title_row' %>
<div id="transfer-notice">To publish a dataset on VTechData please contact <a href="mailto:vtechdata@vt.edu">vtechdata@vt.edu</a>. The ability to create and edit data on VTechData is restricted as we move to a new repository platform.</div>
<%= render partial: '/logo_title_row' %>

<div class="masthead-search-wrapper col-xs-6 col-centered">
<%= render partial: '/catalog/search_form' %>
Expand Down
3 changes: 2 additions & 1 deletion app/views/layouts/sufia-one-column.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<a href="#skip_to_content" class="sr-only">Skip to Content</a>
<%= render partial: '/masthead' %>
<div id="center-wrapper" class="col-xs-11 col-centered">
<%= render partial: '/logo_title_row' %>
<div id="transfer-notice">To publish a dataset on VTechData please contact <a href="mailto:vtechdata@vt.edu">vtechdata@vt.edu</a>. The ability to create and edit data on VTechData is restricted as we move to a new repository platform.</div>
<%= render partial: '/logo_title_row' %>

<div class="masthead-search-wrapper col-xs-6 col-centered">
<%= render partial: '/catalog/search_form' %>
Expand Down