diff --git a/app/controllers/userid_details_controller.rb b/app/controllers/userid_details_controller.rb index 7e706d677..df960536c 100644 --- a/app/controllers/userid_details_controller.rb +++ b/app/controllers/userid_details_controller.rb @@ -17,8 +17,7 @@ class UseridDetailsController < ApplicationController require 'import_users_from_csv' skip_before_action :require_login, only: [:general, :create, :researcher_registration, :transcriber_registration, :technical_registration] rescue_from ActiveRecord::RecordInvalid, with: :record_validation_errors - PERMITTED_ROLES = ['system_administrator', 'syndicate_coordinator', 'county_coordinator', 'country_coordinator', 'master_county_coordinator', 'newsletter_coordinator'] - STATS_PERMITTED_ROLES = ['system_administrator', 'executive_director', 'project_manager', 'engagement_coordinator', 'contacts_coordinator', 'newsletter_coordinator'] + PERMITTED_ROLES = ['system_administrator', 'syndicate_coordinator', 'county_coordinator', 'country_coordinator', 'master_county_coordinator', 'newsletter_coordinator', 'executive_director'] def all session[:user_index_page] = params[:page] if params[:page] @@ -360,7 +359,7 @@ def return_percentage_all_existing_active_users_accepted_transcriber_agreement_o ((total_existing_active_users_accepted / total_existing_active_users) * 100).round(2) end - + def role @userids = UseridDetail.role(params[:role]).all.order_by(userid_lower_case: 1) @@ -637,21 +636,12 @@ def permitted_role? end def permitted_secondary_roles? - roles = @current_user.secondary_role & PERMITTED_ROLES - roles.present? + roles = @current_user.secondary_role & PERMITTED_ROLES + roles.present? end def stats_permitted_users? - stats_access_role? || stats_access_secondary? - end - - def stats_access_role? - STATS_PERMITTED_ROLES.include? @current_user.person_role - end - - def stats_access_secondary? - roles = @current_user.secondary_role & STATS_PERMITTED_ROLES - roles.present? + %w[system_administrator executive_director project_manager engagement_coordinator].include? @current_user.person_role end def get_option_parameter(option, location) diff --git a/app/views/freecen1_vld_files/_index_header.html.erb b/app/views/freecen1_vld_files/_index_header.html.erb index 2b0c5e7e4..9b3681dde 100644 --- a/app/views/freecen1_vld_files/_index_header.html.erb +++ b/app/views/freecen1_vld_files/_index_header.html.erb @@ -2,13 +2,13 @@ <% session[:file_page] = params[:page]%>

Listing of <%= @freecen1_vld_files.length if @freecen1_vld_files.present? %> FreeCen1 VLD Files for <%= @chapman_code%>

<%= render 'flash_notice' %> -<% if %w[system_administrator data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%> +<% if %w[system_administrator data_manager executive_director county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%>
<%= link_to 'List Deleted VLD Files', freecen1_vld_file_audits_path, method: :get , :class => "btn btn--small"%>
<% if %w[system_administrator data_manager country_coordinator].include?(@user.person_role)%> To upload a new file: click this <%= link_to 'Upload new VLD file', new_freecen1_vld_file_path, method: :get , :class => "btn btn--small"%>
<% end %> - <% if %w[system_administrator data_manager county_coordinator master_county_coordinator].include?(@user.person_role)%> + <% if %w[system_administrator data_manager executive_director county_coordinator master_county_coordinator].include?(@user.person_role)%> <%= form_for(:listinvalidcivilparishes, url: list_invalid_civil_parishes_freecen1_vld_file_path, method: :get, data: { confirm: "Are you sure you want to generate a list of VLD fies with invalid Civil Parishes?"}) do |f| %>
<%= f.submit 'List files with invalid Civil Parishes', :class => "btn btn--small", title: 'Sends a list via Email (CSV file attachment)',data: { disable_with: false } %> diff --git a/app/views/freecen1_vld_files/_show_header.html.erb b/app/views/freecen1_vld_files/_show_header.html.erb index 05e7a3352..7e26f177c 100644 --- a/app/views/freecen1_vld_files/_show_header.html.erb +++ b/app/views/freecen1_vld_files/_show_header.html.erb @@ -2,7 +2,7 @@

Listing of <%= @freecen1_vld_file.file_name %> for <%= @chapman_code%>

<%= render 'flash_notice' %>
- <% if %w[data_manager county_coordinator country_coordinator master_county_coordinator system_administrator].include?(@user.person_role)%> + <% if %w[data_manager executive_director county_coordinator country_coordinator master_county_coordinator system_administrator].include?(@user.person_role)%> <%= edit_freecen1_vld_file %> <%= edit_cp_freecen1_vld_file %> <%= link_to 'Download file as CSVPro', csv_download_freecen1_vld_file_path(file: @freecen1_vld_file.id) , :class => "btn btn--small" %> diff --git a/app/views/freecen1_vld_files/index.html.erb b/app/views/freecen1_vld_files/index.html.erb index 2327bc7fe..be07e3878 100644 --- a/app/views/freecen1_vld_files/index.html.erb +++ b/app/views/freecen1_vld_files/index.html.erb @@ -10,7 +10,7 @@ Loaded At Uploaded By Transcriber - <% if %w[system_administrator data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%> + <% if %w[system_administrator data_manager executive_director county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%> Actions <% else%> Actions @@ -28,7 +28,7 @@ <%= freecen1_vld_file.userid %> <%= freecen1_vld_file.transcriber_name %> <%= link_to 'Show', freecen1_vld_file_path(freecen1_vld_file) %> - <% if %w[system_administrator data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%> + <% if %w[system_administrator data_manager executive_director county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role)%> <% if %w[system_administrator data_manager country_coordinator].include?(@user.person_role)%> <%= link_to 'Download', download_vld_file_freecen1_vld_file_path(file: freecen1_vld_file.id), title: 'Download VLD file',data: { confirm: 'Confirm you want to download this VLD file'}, method: :get %> <%= link_to 'Replace', new_freecen1_vld_file_path(replace: freecen1_vld_file.file_name), data: { confirm: 'Confirm you want to replace this file'}, method: :get %> diff --git a/app/views/freecen2_civil_parishes/_basic_index.html.erb b/app/views/freecen2_civil_parishes/_basic_index.html.erb index 490eafca9..36c8f0f33 100644 --- a/app/views/freecen2_civil_parishes/_basic_index.html.erb +++ b/app/views/freecen2_civil_parishes/_basic_index.html.erb @@ -26,8 +26,8 @@ <%= freecen2_civil_parish.number %> <% end%> <%= link_to 'Show',freecen2_civil_parish_path(freecen2_civil_parish, type: @type), :class => "btn btn--small"%> - <% if %w[county_coordinator country_coordinator master_county_coordinator data_manager system_administrator].include?(@user.person_role)%> - <%= link_to 'Edit', edit_freecen2_civil_parish_path(freecen2_civil_parish, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Editing is restricted to, coordinators, data managers and system administrators'%> + <% if %w[county_coordinator country_coordinator master_county_coordinator data_manager executive_director system_administrator].include?(@user.person_role)%> + <%= link_to 'Edit', edit_freecen2_civil_parish_path(freecen2_civil_parish, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Editing is restricted to, coordinators, data managers, executive directors and system administrators'%> <% end %> <% end %> diff --git a/app/views/freecen2_civil_parishes/_show_header.html.erb b/app/views/freecen2_civil_parishes/_show_header.html.erb index cacf021a4..ce960dd92 100644 --- a/app/views/freecen2_civil_parishes/_show_header.html.erb +++ b/app/views/freecen2_civil_parishes/_show_header.html.erb @@ -11,7 +11,7 @@ <%= link_to 'Edit Civil Parish Name', edit_name_freecen2_civil_parish_path(@freecen2_civil_parish, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Edit of the name allows a correction but will NOT permit a rename to a Parish with the new name'%>
<% end%> -<% if %w[data_manager system_administrator].include?(@user.person_role) or (%w[county_coordinator master_county_coordinator].include?(@user.person_role) and ("1901" "1911").include?(@freecen2_civil_parish.year))%> +<% if %w[data_manager system_administrator].include?(@user.person_role) or (%w[county_coordinator master_county_coordinator executive_director].include?(@user.person_role) and ("1901" "1911").include?(@freecen2_civil_parish.year))%>
<%= link_to 'Delete Civil Parish', freecen2_civil_parish_path(@freecen2_civil_parish), method: :delete, data: { confirm: 'Are you sure you want to delete this Civil Parish?' } , :class => "btn btn--small"%>
diff --git a/app/views/freecen2_districts/_show_header.html.erb b/app/views/freecen2_districts/_show_header.html.erb index d0744bf8b..358ec6477 100644 --- a/app/views/freecen2_districts/_show_header.html.erb +++ b/app/views/freecen2_districts/_show_header.html.erb @@ -1,7 +1,7 @@

Details of FreeCen2 District:- <%= @freecen2_district.name%> in <%=ChapmanCode.name_from_code(@chapman_code)%> (<%=@chapman_code%>)

<%= render 'flash_notice' %>

Name changes will normally be done with the Edit District Name action and extremely rarely using the main Edit action

-<% if %w[county_coordinator master_county_coordinator country_coordinator data_manager system_administrator].include?(@user.person_role)%> +<% if %w[county_coordinator master_county_coordinator country_coordinator data_manager executive_director system_administrator].include?(@user.person_role)%>
<%= link_to 'Edit District', edit_freecen2_district_path(@freecen2_district, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Edit of all fields; note the edit of a district name functions as a merge of this District into another District'%>
diff --git a/app/views/freecen2_pieces/_show_header.html.erb b/app/views/freecen2_pieces/_show_header.html.erb index e76a6d606..23dba00a5 100644 --- a/app/views/freecen2_pieces/_show_header.html.erb +++ b/app/views/freecen2_pieces/_show_header.html.erb @@ -14,7 +14,7 @@ <%= link_to 'Delete Piece', freecen2_piece_path(@freecen2_piece), method: :delete, data: { confirm: 'Are you sure you want to destroy this Piece.? It will not happen if there are dependants!' } , :class => "btn btn--small"%>
<% end%> - <% if %w[data_manager system_administrator].include?(@user.person_role) or (%w[county_coordinator master_county_coordinator].include?(@user.person_role) and ("1901" "1911").include?(@freecen2_piece.year))%> + <% if %w[data_manager system_administrator].include?(@user.person_role) or (%w[county_coordinator master_county_coordinator executive_director].include?(@user.person_role) and ("1901" "1911").include?(@freecen2_piece.year))%>
<%= link_to 'Add Civil Parish', new_freecen2_civil_parish_path(piece: @freecen2_piece, type: @type), data: { confirm: 'Are you sure?' }, :class => "btn btn--small", title: 'Adding a Civil Parish is restricted to data managers and system administrators. For 1901 and 1911 this is also possible for county coordinators'%>
diff --git a/app/views/freecen_csv_files/_coordinator_header.html.erb b/app/views/freecen_csv_files/_coordinator_header.html.erb index 5160500dc..5203f92b4 100644 --- a/app/views/freecen_csv_files/_coordinator_header.html.erb +++ b/app/views/freecen_csv_files/_coordinator_header.html.erb @@ -1,7 +1,7 @@ <% breadcrumb :freecen_csv_files, @freecen_csv_file %>

Videos describing <%= link_to 'this page', "https://youtu.be/GnkkKkVGXs8", target: '_blank' %>, <%= link_to 'download a spreadsheet file', "https://youtu.be/2ekZ_VXmTn0", target: '_blank' %>, <%= link_to 'upload traditional file', "https://youtu.be/DM889numA-s" , target: '_blank'%>, <%= link_to 'upload new CSVProc file', "https://youtu.be/GnkkKkVGXs8" , target: '_blank'%>, <%= link_to 'show details of the file', "https://youtu.be/f0l1tlWESII" , target: '_blank' %>, <%= link_to 'errors display', "https://youtu.be/f0l1tlWESII" , target: '_blank' %>, <%= link_to 'replace a file', "https://youtu.be/XH-QBKRg9gQ" , target: '_blank' %> (all open in new tabs)

-<% if %w[system_administrator data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role) && session[:selection] == 'all'%> +<% if %w[system_administrator executive_director data_manager county_coordinator country_coordinator master_county_coordinator].include?(@user.person_role) && session[:selection] == 'all'%>
<%= link_to 'List CSV files that have been Unincorporated/Removed/Deleted', freecen_csv_file_audits_path, method: :get , :class => "btn btn--small"%>
diff --git a/app/views/freecen_csv_files/_form.html.erb b/app/views/freecen_csv_files/_form.html.erb index 40df34180..9cc84a886 100644 --- a/app/views/freecen_csv_files/_form.html.erb +++ b/app/views/freecen_csv_files/_form.html.erb @@ -1,6 +1,6 @@ <%= semantic_form_for @freecen_csv_file , :html => { :class => 'grid'} do |f| %> <%= f.input :transcriber_name , :input_html => {:class => ' simple_form_bgcolour ', :size => 30 }%> - <% if session[:my_own] || %w[syndicate_coordinator master_county_coordinator county_coordinator system_administrator country_coordinator data_manager].include?(session[:role]) %> + <% if session[:my_own] || %w[syndicate_coordinator master_county_coordinator county_coordinator system_administrator country_coordinator data_manager executive_director].include?(session[:role]) %> <%= f.input :locked_by_transcriber, :label => 'Locked by transcriber ',:include_blank => false, :collection => [ true, false],:input_html => {:class => ' simple_form_bgcolour medium_selection_field_width', :size => 3} %> <% if session[:my_own]%> @@ -13,11 +13,11 @@ <%= f.input :locked_by_transcriber, :input_html => { :disabled => true, :size => 3} %> <%= f.input :locked_by_coordinator, :input_html => {:disabled => true, :size => 3} %> <% end %> - <% if %w[master_county_coordinator county_coordinator system_administrator country_coordinator data_manager].include?(session[:role]) %> + <% if %w[master_county_coordinator county_coordinator system_administrator country_coordinator data_manager executive_director].include?(session[:role]) %> <%= f.input :incorporation_lock, :label => 'Incorporation lock ',:include_blank => false, :collection => [ true, false],:input_html => {:class => ' simple_form_bgcolour medium_selection_field_width', :size => 3} %> <% end %> - <% if %w[master_county_coordinator county_coordinator system_administrator country_coordinator data_manager].include?(session[:role]) %> + <% if %w[master_county_coordinator county_coordinator system_administrator country_coordinator data_manager executive_director].include?(session[:role]) %> <%= f.input :incorporating_lock, :label => 'Incorporating lock ',:include_blank => false, :collection => [ true, false],:input_html => {:class => ' simple_form_bgcolour medium_selection_field_width', :size => 3} %> <% end %> diff --git a/app/views/freecen_pieces/chapman_year_index.html.erb b/app/views/freecen_pieces/chapman_year_index.html.erb index 99ae4f229..1d77994f5 100644 --- a/app/views/freecen_pieces/chapman_year_index.html.erb +++ b/app/views/freecen_pieces/chapman_year_index.html.erb @@ -29,7 +29,7 @@ <%= link_to 'Show', freecen_piece , :class => "btn btn--small"%> <%= link_to 'Edit', edit_freecen_piece_path(freecen_piece.id), data: { confirm: 'Are you sure?' }, :class => "btn btn--small" %> <%= link_to 'Destroy', freecen_piece_path(freecen_piece.id), method: :delete, :class => "btn btn--small", - data: { confirm: 'Are you sure you want to destroy this Piece.? It will not happen if there are dependants!' } if ['data_manager', 'system_administrator', 'county_coordinator', 'master_county_coordinator'].include?(@user.person_role) %> + data: { confirm: 'Are you sure you want to destroy this Piece.? It will not happen if there are dependants!' } if ['data_manager', 'executive_director', 'system_administrator', 'county_coordinator', 'master_county_coordinator'].include?(@user.person_role) %> <% end %> diff --git a/app/views/userid_details/_form_freecen.html.erb b/app/views/userid_details/_form_freecen.html.erb index 6629ede70..c4209ef6e 100644 --- a/app/views/userid_details/_form_freecen.html.erb +++ b/app/views/userid_details/_form_freecen.html.erb @@ -33,10 +33,10 @@ <% end %> - <% if %w[system_administrator county_coordinator master_county_coordinator syndicate_coordinator volunteer_coordinator].include?(@user.person_role) && !session[:my_own] %> + <% if %w[system_administrator executive_director county_coordinator master_county_coordinator syndicate_coordinator volunteer_coordinator].include?(@user.person_role) && !session[:my_own] %> <%= f.input :syndicate,:label => "Syndicate",:include_blank => false, :collection => @syndicates,:input_html => { :class => "text-input simple_form_bgcolour simple_form_position", :size => 4 }, :hint => "The syndicate MUST be selected"%> <% end%> - <% if %w[system_administrator county_coordinator master_county_coordinator syndicate_coordinator].include?(@user.person_role) && !session[:my_own] %> + <% if %w[system_administrator executive_director county_coordinator master_county_coordinator syndicate_coordinator].include?(@user.person_role) && !session[:my_own] %> <%= f.input :person_role, :collection => UseridRole::VALUES, :include_blank => false,:label => "Role in #{appname} :", :input_html => { :class => " simple_form_bgcolour simple_form_position overide_selection_field_width", :size => 4 } %> <%= f.input :secondary_role, :collection => UseridRole::VALUES, :include_blank => true,:label => "Secondary Role(s) in #{appname} :", :input_html => { :class => " simple_form_bgcolour simple_form_position overide_selection_field_width", :size => 4, multiple: true }, include_hidden: true, :hint => "Hold Ctrl or Shift to select multiple roles" unless appname.downcase == 'freecen'%> <% end %> @@ -67,6 +67,6 @@ $("#form_control").hide(); } }); - + }); \ No newline at end of file diff --git a/app/views/userid_details/_show_header_links.html.erb b/app/views/userid_details/_show_header_links.html.erb index e686eed7d..aefa6756c 100644 --- a/app/views/userid_details/_show_header_links.html.erb +++ b/app/views/userid_details/_show_header_links.html.erb @@ -2,10 +2,12 @@ <% if session[:edit_userid] %> <%= list_userid_files %> <%= link_to 'Edit', edit_userid_detail_path(@userid, page_name: @page_name), method: :get, :class => "btn btn--small " %> - <% if %w[system_administrator syndicate_coordinator volunteer_coordinator county_coordinator master_county_coordinator country_coordinator ].include?(@user.person_role) %> - <%= link_to " Send password change request", change_password_userid_detail_path(@userid, page_name: @page_name), data: { confirm: 'You are sending a password reset email to the user. Do you wish to proceed?' }, method: :get, class: "btn btn--small ", title: 'The person will receive an email within a minute or 2. If they do not get them to check their spam folder and check their email address'%> - <%= link_to ' Move to inactive syndicate', move_userid_detail_path(@userid), data: { confirm: 'Are you absolutely sure?' }, method: :get, :class => "btn btn--small " unless @userid.syndicate == 'To be Destroyed' && @user.person_role == 'system_administrator'%> - <%= link_to ' Destroy', userid_detail_path(@userid), data: { confirm: 'Are you absolutely sure?' }, method: :delete, :class => "btn btn--small " if @userid.syndicate == 'To be Destroyed' && @user.person_role == 'system_administrator'%> + <% if %w[system_administrator executive_director syndicate_coordinator volunteer_coordinator county_coordinator master_county_coordinator country_coordinator ].include?(@user.person_role)%> + <%= link_to " Send password change request", change_password_userid_detail_path(@userid, page_name: @page_name), data: { confirm: 'You are sending a password reset email to the user. Do you wish to proceed?' }, method: :get, class: "btn btn--small ", title: 'The person will receive an email within a minute or 2. If they do not get them to check their spam folder and check their email address' unless @user.person_role == 'executive_director'%> + <% if %w[system_administrator executive_director].include?(@user.person_role) %> + <%= link_to ' Move to inactive syndicate', move_userid_detail_path(@userid), data: { confirm: 'Are you absolutely sure?' }, method: :get, :class => "btn btn--small " unless @userid.syndicate == 'To be Destroyed'%> + <%= link_to ' Destroy', userid_detail_path(@userid), data: { confirm: 'Are you absolutely sure?' }, method: :delete, :class => "btn btn--small " if @userid.syndicate == 'To be Destroyed'%> + <% end %> <% end %> <% end %> \ No newline at end of file