diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb
index 5bbc856..3a50d54 100644
--- a/app/controllers/roles_controller.rb
+++ b/app/controllers/roles_controller.rb
@@ -10,22 +10,26 @@
set_access_level(access_level)
if params[:user].present?
if @role.plan.owner.present? && @role.plan.owner.email == params[:user]
- flash[:notice] = _('Impossible sharing plan with %{email} since that email matches with the owner of the plan.') % {email: params[:user]}
- else
- message = _('User added to project')
- user = User.find_by(email: params[:user])
- if user.nil?
- registered = false
- User.invite!(email: params[:user])
- message = _('Invitation issued successfully.')
+ flash[:notice] = _('Cannot share plan with %{email} since that email matches with the owner of the plan.') % {email: params[:user]}
+ else
+ if Role.find_by(plan: @role.plan, user: User.find_by(email: params[:user])) # role already exists
+ flash[:notice] = _('Plan is already shared with %{email}.') % {email: params[:user]}
+ else
+ message = _('Plan shared with %{email}.') % {email: params[:user]}
user = User.find_by(email: params[:user])
- end
- @role.user = user
- if @role.save
- if registered then UserMailer.sharing_notification(@role, current_user).deliver_now end
- flash[:notice] = message
- else
- flash[:notice] = failed_create_error(@role, _('role'))
+ if user.nil?
+ registered = false
+ User.invite!(email: params[:user])
+ message = _('Invitation to %{email} issued successfully.') % {email: params[:user]}
+ user = User.find_by(email: params[:user])
+ end
+ @role.user = user
+ if @role.save
+ if registered then UserMailer.sharing_notification(@role, current_user).deliver_now end
+ flash[:notice] = message
+ else
+ flash[:notice] = failed_create_error(@role, _('role'))
+ end
end
end
else
diff --git a/app/models/user.rb b/app/models/user.rb
index 14f1af2..8ea0608 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -108,7 +108,7 @@
# @param new_organisation_id [Integer] the id for an organisation
# @return [String] the empty string as a causality of setting api_token
def org_id=(new_org_id)
- unless self.can_change_org? || new_org_id.nil? || self.org.nil?
+ unless self.can_change_org? || new_org_id.nil? || self.org.nil? || (new_org_id.to_s == self.org.id.to_s)
# rip all permissions from the user
self.perms.delete_all
end
diff --git a/app/views/devise/registrations/_external_identifier.html.erb b/app/views/devise/registrations/_external_identifier.html.erb
index d1071f6..226b270 100644
--- a/app/views/devise/registrations/_external_identifier.html.erb
+++ b/app/views/devise/registrations/_external_identifier.html.erb
@@ -1,6 +1,6 @@
<% if id.nil? || id.identifier == '' %>
- <%= link_to "#{_("Create or Link your #{scheme.description} ID")}",
+ <%= link_to "#{_("Link account with #{scheme.description} ID")}",
Rails.application.routes.url_helpers.send(
"user_#{scheme.name.downcase}_omniauth_authorize_path"
),
diff --git a/app/views/users/admin_grant_permissions.html.erb b/app/views/users/admin_grant_permissions.html.erb
index ad925cc..e15b781 100644
--- a/app/views/users/admin_grant_permissions.html.erb
+++ b/app/views/users/admin_grant_permissions.html.erb
@@ -8,7 +8,7 @@
<%= form_tag( admin_update_permissions_user_path(@user), method: :put) do %>
-
+
<% @perms.each do |perm| %>
<% case perm.name when 'grant_permissions' %>
| \n"
"Language-Team: LANGUAGE \n"
"Language: \n"
@@ -24,9 +24,6 @@
msgid " - "
msgstr ""
-msgid " Guidance"
-msgstr ""
-
msgid " I accept the terms and conditions *"
msgstr ""
@@ -87,7 +84,7 @@
msgid " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on "
msgstr ""
-msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\""
+msgid "\"Are you sure you want to unlink #{scheme.description} ID?\""
msgstr ""
msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\""
@@ -231,6 +228,9 @@
msgid "API Information"
msgstr ""
+msgid "API rights"
+msgstr ""
+
msgid "API token"
msgstr ""
@@ -291,6 +291,18 @@
msgid "All the best,"
msgstr ""
+msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo"
+msgstr ""
+
+msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves"
+msgstr ""
+
+msgid "Allows the user to create and edit guidance"
+msgstr ""
+
+msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates"
+msgstr ""
+
msgid "An error has occurred while saving/resetting your export settings."
msgstr ""
@@ -306,9 +318,6 @@
msgid "Answered"
msgstr ""
-msgid "Answered "
-msgstr ""
-
msgid "Answered at"
msgstr ""
@@ -363,12 +372,18 @@
msgid "Cancel"
msgstr ""
+msgid "Cannot share plan with %{email} since that email matches with the owner of the plan."
+msgstr ""
+
msgid "Change language"
msgstr ""
msgid "Change my password"
msgstr ""
+msgid "Change organisation details"
+msgstr ""
+
msgid "Check box"
msgstr ""
@@ -609,12 +624,18 @@
msgid "Grant number"
msgstr ""
+msgid "Grant permissions"
+msgstr ""
+
msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]"
msgstr ""
msgid "Guidance"
msgstr ""
+msgid "Guidance choices saved."
+msgstr ""
+
msgid "Guidance group"
msgstr ""
@@ -690,9 +711,6 @@
msgid "If you would like to change your password please complete the following fields."
msgstr ""
-msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan."
-msgstr ""
-
msgid "Included Elements"
msgstr ""
@@ -717,7 +735,7 @@
msgid "Invalid maximum pages"
msgstr ""
-msgid "Invitation issued successfully."
+msgid "Invitation to %{email} issued successfully."
msgstr ""
msgid "Language"
@@ -765,6 +783,12 @@
msgid "Message"
msgstr ""
+msgid "Modify guidance"
+msgstr ""
+
+msgid "Modify templates"
+msgstr ""
+
msgid "Multi select box"
msgstr ""
@@ -930,9 +954,15 @@
msgid "Plan details"
msgstr ""
+msgid "Plan is already shared with %{email}."
+msgstr ""
+
msgid "Plan name"
msgstr ""
+msgid "Plan shared with %{email}."
+msgstr ""
+
msgid "Plan was successfully deleted."
msgstr ""
@@ -1017,6 +1047,9 @@
msgid "Project title"
msgstr ""
+msgid "Provides the user with an API token and grants rights to harvest information from the tool"
+msgstr ""
+
msgid "Public"
msgstr ""
@@ -1320,9 +1353,6 @@
msgid "Upload a new logo file"
msgstr ""
-msgid "User added to project"
-msgstr ""
-
msgid "Users"
msgstr ""
@@ -1584,9 +1614,6 @@
msgid "height must be less than 100px"
msgstr ""
-msgid "helpers.dropdown"
-msgstr ""
-
msgid "helpers.is_test"
msgstr ""
diff --git a/config/locale/de/app.po b/config/locale/de/app.po
index b52820b..7251de4 100644
--- a/config/locale/de/app.po
+++ b/config/locale/de/app.po
@@ -23,10 +23,6 @@
msgstr " - "
#, fuzzy
-msgid " Guidance"
-msgstr "Hilfestellung"
-
-#, fuzzy
msgid " I accept the terms and conditions *"
msgstr "Ich akzeptiere die Nutzungsbedingungen *"
@@ -98,7 +94,7 @@
msgstr ""
#, fuzzy
-msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\""
+msgid "\"Are you sure you want to unlink #{scheme.description} ID?\""
msgstr "ID"
msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\""
@@ -249,6 +245,9 @@
msgid "API Information"
msgstr ""
+msgid "API rights"
+msgstr ""
+
msgid "API token"
msgstr ""
@@ -309,6 +308,22 @@
msgid "All the best,"
msgstr ""
+#, fuzzy
+msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo"
+msgstr "Organisation"
+
+#, fuzzy
+msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves"
+msgstr "Organisation"
+
+#, fuzzy
+msgid "Allows the user to create and edit guidance"
+msgstr "user"
+
+#, fuzzy
+msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates"
+msgstr "templates"
+
msgid "An error has occurred while saving/resetting your export settings."
msgstr ""
@@ -327,10 +342,6 @@
msgstr "Beantwortet "
#, fuzzy
-msgid "Answered "
-msgstr "Beantwortet "
-
-#, fuzzy
msgid "Answered at"
msgstr "Beantwortet "
@@ -387,6 +398,10 @@
msgid "Cancel"
msgstr "Abbrechen"
+#, fuzzy
+msgid "Cannot share plan with %{email} since that email matches with the owner of the plan."
+msgstr "plans"
+
msgid "Change language"
msgstr ""
@@ -394,6 +409,10 @@
msgid "Change my password"
msgstr "Passwort ändern"
+#, fuzzy
+msgid "Change organisation details"
+msgstr "Organisation"
+
msgid "Check box"
msgstr "Checkbox"
@@ -645,12 +664,19 @@
msgid "Grant number"
msgstr "Grantnummer"
+msgid "Grant permissions"
+msgstr ""
+
msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]"
msgstr "Das Förderkennzeichen als Referenz, sofern sinnvoll (Nur für Datenmanagement-Pläne nach der Bewilligung)."
msgid "Guidance"
msgstr "Hilfestellung"
+#, fuzzy
+msgid "Guidance choices saved."
+msgstr "Hilfestellung"
+
msgid "Guidance group"
msgstr "Hilfestellungsgruppe"
@@ -729,9 +755,6 @@
msgid "If you would like to change your password please complete the following fields."
msgstr "Zum Ändern Ihres Passworts folgende Felder ausfüllen."
-msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan."
-msgstr ""
-
msgid "Included Elements"
msgstr "Enthaltene Elemente"
@@ -756,7 +779,7 @@
msgid "Invalid maximum pages"
msgstr "Ungültige maximale Anzahl von Seiten"
-msgid "Invitation issued successfully."
+msgid "Invitation to %{email} issued successfully."
msgstr ""
msgid "Language"
@@ -805,6 +828,14 @@
msgid "Message"
msgstr "Ich"
+#, fuzzy
+msgid "Modify guidance"
+msgstr "Hilfestellung hinzufügen"
+
+#, fuzzy
+msgid "Modify templates"
+msgstr "templates"
+
msgid "Multi select box"
msgstr "Mehrfachauswahlliste"
@@ -975,9 +1006,15 @@
msgid "Plan details"
msgstr "Plandetails"
+msgid "Plan is already shared with %{email}."
+msgstr ""
+
msgid "Plan name"
msgstr "Name des Plans"
+msgid "Plan shared with %{email}."
+msgstr ""
+
#, fuzzy
msgid "Plan was successfully deleted."
msgstr "Plan wurde erfolgreich angelegt."
@@ -1065,6 +1102,10 @@
msgid "Project title"
msgstr ""
+#, fuzzy
+msgid "Provides the user with an API token and grants rights to harvest information from the tool"
+msgstr "user"
+
msgid "Public"
msgstr "Öffentlichkeit"
@@ -1377,9 +1418,6 @@
msgid "Upload a new logo file"
msgstr "Laden Sie ein neues Logo-Datei"
-msgid "User added to project"
-msgstr ""
-
msgid "Users"
msgstr "Nutzer"
@@ -1677,9 +1715,6 @@
msgid "height must be less than 100px"
msgstr ""
-msgid "helpers.dropdown"
-msgstr ""
-
msgid "helpers.is_test"
msgstr ""
diff --git a/config/locale/en_GB/app.po b/config/locale/en_GB/app.po
index 8c0cca3..244d1d9 100644
--- a/config/locale/en_GB/app.po
+++ b/config/locale/en_GB/app.po
@@ -23,10 +23,6 @@
msgstr " - "
#, fuzzy
-msgid " Guidance"
-msgstr "Guidance"
-
-#, fuzzy
msgid " I accept the terms and conditions *"
msgstr " I accept the terms and conditions *"
@@ -94,7 +90,8 @@
msgid " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on "
msgstr " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on "
-msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\""
+#, fuzzy
+msgid "\"Are you sure you want to unlink #{scheme.description} ID?\""
msgstr "\"Are you sure you want to unlink your #{scheme.description} ID?\""
msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\""
@@ -240,6 +237,9 @@
msgid "API Information"
msgstr "API Information"
+msgid "API rights"
+msgstr ""
+
msgid "API token"
msgstr "API token"
@@ -300,6 +300,22 @@
msgid "All the best,"
msgstr ""
+#, fuzzy
+msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo"
+msgstr "organisation"
+
+#, fuzzy
+msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves"
+msgstr "organisation"
+
+#, fuzzy
+msgid "Allows the user to create and edit guidance"
+msgstr "guidance"
+
+#, fuzzy
+msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates"
+msgstr "template"
+
msgid "An error has occurred while saving/resetting your export settings."
msgstr ""
@@ -315,10 +331,6 @@
msgid "Answered"
msgstr "Answered"
-#, fuzzy
-msgid "Answered "
-msgstr "Answered"
-
msgid "Answered at"
msgstr "Answered at"
@@ -374,12 +386,20 @@
msgid "Cancel"
msgstr "Cancel"
+#, fuzzy
+msgid "Cannot share plan with %{email} since that email matches with the owner of the plan."
+msgstr "plan"
+
msgid "Change language"
msgstr "Change language"
msgid "Change my password"
msgstr "Change my password"
+#, fuzzy
+msgid "Change organisation details"
+msgstr "organisation"
+
msgid "Check box"
msgstr "Check box"
@@ -626,12 +646,19 @@
msgid "Grant number"
msgstr "Grant number"
+msgid "Grant permissions"
+msgstr ""
+
msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]"
msgstr "Grant reference number if applicable [POST-AWARD DMPs ONLY]"
msgid "Guidance"
msgstr "Guidance"
+#, fuzzy
+msgid "Guidance choices saved."
+msgstr "Guidance"
+
msgid "Guidance group"
msgstr "Guidance group"
@@ -708,9 +735,6 @@
msgid "If you would like to change your password please complete the following fields."
msgstr "If you would like to change your password please complete the following fields."
-msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan."
-msgstr ""
-
msgid "Included Elements"
msgstr "Included Elements"
@@ -735,7 +759,8 @@
msgid "Invalid maximum pages"
msgstr "Invalid maximum pages"
-msgid "Invitation issued successfully."
+#, fuzzy
+msgid "Invitation to %{email} issued successfully."
msgstr "Invitation issued successfully."
msgid "Language"
@@ -784,6 +809,14 @@
msgid "Message"
msgstr "Me"
+#, fuzzy
+msgid "Modify guidance"
+msgstr "guidance"
+
+#, fuzzy
+msgid "Modify templates"
+msgstr "template"
+
msgid "Multi select box"
msgstr "Multi select box"
@@ -953,9 +986,15 @@
msgid "Plan details"
msgstr "Plan details"
+msgid "Plan is already shared with %{email}."
+msgstr ""
+
msgid "Plan name"
msgstr "Plan name"
+msgid "Plan shared with %{email}."
+msgstr ""
+
msgid "Plan was successfully deleted."
msgstr "Plan was successfully deleted."
@@ -1042,6 +1081,10 @@
msgid "Project title"
msgstr ""
+#, fuzzy
+msgid "Provides the user with an API token and grants rights to harvest information from the tool"
+msgstr "API token"
+
msgid "Public"
msgstr "Public"
@@ -1350,9 +1393,6 @@
msgid "Upload a new logo file"
msgstr "Upload a new logo file"
-msgid "User added to project"
-msgstr "User added to project"
-
msgid "Users"
msgstr "Users"
@@ -1628,9 +1668,6 @@
msgid "height must be less than 100px"
msgstr ""
-msgid "helpers.dropdown"
-msgstr ""
-
msgid "helpers.is_test"
msgstr ""
diff --git a/config/locale/en_US/app.po b/config/locale/en_US/app.po
index b70e2b3..dbb07f4 100644
--- a/config/locale/en_US/app.po
+++ b/config/locale/en_US/app.po
@@ -23,10 +23,6 @@
msgstr " - "
#, fuzzy
-msgid " Guidance"
-msgstr "Guidance"
-
-#, fuzzy
msgid " I accept the terms and conditions *"
msgstr " I accept the terms and conditions *"
@@ -94,7 +90,8 @@
msgid " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on "
msgstr " will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on "
-msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\""
+#, fuzzy
+msgid "\"Are you sure you want to unlink #{scheme.description} ID?\""
msgstr "\"Are you sure you want to unlink your #{scheme.description} ID?\""
msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\""
@@ -240,6 +237,9 @@
msgid "API Information"
msgstr "API Information"
+msgid "API rights"
+msgstr ""
+
msgid "API token"
msgstr "API token"
@@ -300,6 +300,22 @@
msgid "All the best,"
msgstr ""
+#, fuzzy
+msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo"
+msgstr "organization"
+
+#, fuzzy
+msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves"
+msgstr "organization"
+
+#, fuzzy
+msgid "Allows the user to create and edit guidance"
+msgstr "guidance"
+
+#, fuzzy
+msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates"
+msgstr "template"
+
msgid "An error has occurred while saving/resetting your export settings."
msgstr ""
@@ -315,10 +331,6 @@
msgid "Answered"
msgstr "Answered"
-#, fuzzy
-msgid "Answered "
-msgstr "Answered"
-
msgid "Answered at"
msgstr "Answered at"
@@ -374,12 +386,20 @@
msgid "Cancel"
msgstr "Cancel"
+#, fuzzy
+msgid "Cannot share plan with %{email} since that email matches with the owner of the plan."
+msgstr "plan"
+
msgid "Change language"
msgstr "Change language"
msgid "Change my password"
msgstr "Change my password"
+#, fuzzy
+msgid "Change organisation details"
+msgstr "organization"
+
msgid "Check box"
msgstr "Check box"
@@ -626,12 +646,19 @@
msgid "Grant number"
msgstr "Grant Number"
+msgid "Grant permissions"
+msgstr ""
+
msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]"
msgstr "Grant reference number if applicable [POST-AWARD DMPs ONLY]"
msgid "Guidance"
msgstr "Guidance"
+#, fuzzy
+msgid "Guidance choices saved."
+msgstr "Guidance"
+
msgid "Guidance group"
msgstr "Guidance group"
@@ -708,9 +735,6 @@
msgid "If you would like to change your password please complete the following fields."
msgstr "If you would like to change your password please complete the following fields."
-msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan."
-msgstr ""
-
msgid "Included Elements"
msgstr "Included Elements"
@@ -735,7 +759,8 @@
msgid "Invalid maximum pages"
msgstr "Invalid maximum pages"
-msgid "Invitation issued successfully."
+#, fuzzy
+msgid "Invitation to %{email} issued successfully."
msgstr "Invitation issued successfully."
msgid "Language"
@@ -784,6 +809,14 @@
msgid "Message"
msgstr "Me"
+#, fuzzy
+msgid "Modify guidance"
+msgstr "guidance"
+
+#, fuzzy
+msgid "Modify templates"
+msgstr "template"
+
msgid "Multi select box"
msgstr "Multi select box"
@@ -953,9 +986,15 @@
msgid "Plan details"
msgstr "Plan details"
+msgid "Plan is already shared with %{email}."
+msgstr ""
+
msgid "Plan name"
msgstr "Plan name"
+msgid "Plan shared with %{email}."
+msgstr ""
+
msgid "Plan was successfully deleted."
msgstr "Plan was successfully deleted."
@@ -1042,6 +1081,10 @@
msgid "Project title"
msgstr ""
+#, fuzzy
+msgid "Provides the user with an API token and grants rights to harvest information from the tool"
+msgstr "API token"
+
msgid "Public"
msgstr "Public"
@@ -1350,9 +1393,6 @@
msgid "Upload a new logo file"
msgstr "Upload a new logo file"
-msgid "User added to project"
-msgstr "User added to project"
-
msgid "Users"
msgstr "Users"
@@ -1628,9 +1668,6 @@
msgid "height must be less than 100px"
msgstr ""
-msgid "helpers.dropdown"
-msgstr ""
-
msgid "helpers.is_test"
msgstr ""
diff --git a/config/locale/es/app.po b/config/locale/es/app.po
index 5711578..c7cfe48 100644
--- a/config/locale/es/app.po
+++ b/config/locale/es/app.po
@@ -23,10 +23,6 @@
msgstr ""
#, fuzzy
-msgid " Guidance"
-msgstr "Guía"
-
-#, fuzzy
msgid " I accept the terms and conditions *"
msgstr " Acepto los términos y condiciones *"
@@ -95,7 +91,7 @@
msgstr ""
#, fuzzy
-msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\""
+msgid "\"Are you sure you want to unlink #{scheme.description} ID?\""
msgstr "ID"
msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\""
@@ -245,6 +241,9 @@
msgid "API Information"
msgstr ""
+msgid "API rights"
+msgstr ""
+
msgid "API token"
msgstr ""
@@ -305,6 +304,22 @@
msgid "All the best,"
msgstr ""
+#, fuzzy
+msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo"
+msgstr "Organización"
+
+#, fuzzy
+msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves"
+msgstr "Organización"
+
+#, fuzzy
+msgid "Allows the user to create and edit guidance"
+msgstr "user"
+
+#, fuzzy
+msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates"
+msgstr "templates"
+
msgid "An error has occurred while saving/resetting your export settings."
msgstr ""
@@ -323,10 +338,6 @@
msgstr "Contestado "
#, fuzzy
-msgid "Answered "
-msgstr "Contestado "
-
-#, fuzzy
msgid "Answered at"
msgstr "Contestado "
@@ -384,6 +395,10 @@
msgid "Cancel"
msgstr "Cancelar"
+#, fuzzy
+msgid "Cannot share plan with %{email} since that email matches with the owner of the plan."
+msgstr "plans"
+
msgid "Change language"
msgstr ""
@@ -391,6 +406,10 @@
msgid "Change my password"
msgstr "Cambiar su clave"
+#, fuzzy
+msgid "Change organisation details"
+msgstr "Organización"
+
msgid "Check box"
msgstr "Check box"
@@ -641,12 +660,19 @@
msgid "Grant number"
msgstr "Título de subvención"
+msgid "Grant permissions"
+msgstr ""
+
msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]"
msgstr "Número de referencia de la subvención si es aplicable [SÓLO PGDs YA ADJUDICADOS]"
msgid "Guidance"
msgstr "Guía"
+#, fuzzy
+msgid "Guidance choices saved."
+msgstr "Guía"
+
msgid "Guidance group"
msgstr "Grupo de orientación"
@@ -724,9 +750,6 @@
msgid "If you would like to change your password please complete the following fields."
msgstr "Si quiere cambiar su clave, por favor, rellene los siguientes campos."
-msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan."
-msgstr ""
-
msgid "Included Elements"
msgstr "Elementos incluídos"
@@ -751,7 +774,7 @@
msgid "Invalid maximum pages"
msgstr "Número de páginas inválido"
-msgid "Invitation issued successfully."
+msgid "Invitation to %{email} issued successfully."
msgstr ""
msgid "Language"
@@ -800,6 +823,14 @@
msgid "Message"
msgstr "Yo"
+#, fuzzy
+msgid "Modify guidance"
+msgstr "Añadir orientación"
+
+#, fuzzy
+msgid "Modify templates"
+msgstr "templates"
+
msgid "Multi select box"
msgstr "Multi select box"
@@ -970,9 +1001,15 @@
msgid "Plan details"
msgstr "Detalles"
+msgid "Plan is already shared with %{email}."
+msgstr ""
+
msgid "Plan name"
msgstr "Nombre de proyecto"
+msgid "Plan shared with %{email}."
+msgstr ""
+
#, fuzzy
msgid "Plan was successfully deleted."
msgstr "Plan creado con éxito"
@@ -1060,6 +1097,10 @@
msgid "Project title"
msgstr ""
+#, fuzzy
+msgid "Provides the user with an API token and grants rights to harvest information from the tool"
+msgstr "user"
+
msgid "Public"
msgstr "Público"
@@ -1370,9 +1411,6 @@
msgid "Upload a new logo file"
msgstr ""
-msgid "User added to project"
-msgstr ""
-
msgid "Users"
msgstr "Usuarios"
@@ -1662,9 +1700,6 @@
msgid "height must be less than 100px"
msgstr ""
-msgid "helpers.dropdown"
-msgstr ""
-
msgid "helpers.is_test"
msgstr ""
diff --git a/config/locale/fr/app.po b/config/locale/fr/app.po
index 21b7c0d..fc41878 100644
--- a/config/locale/fr/app.po
+++ b/config/locale/fr/app.po
@@ -23,10 +23,6 @@
msgstr ""
#, fuzzy
-msgid " Guidance"
-msgstr "Conseils"
-
-#, fuzzy
msgid " I accept the terms and conditions *"
msgstr " Jaccepte les Conditions générales dutilisation. *"
@@ -95,7 +91,7 @@
msgstr ""
#, fuzzy
-msgid "\"Are you sure you want to unlink your #{scheme.description} ID?\""
+msgid "\"Are you sure you want to unlink #{scheme.description} ID?\""
msgstr "Identifiant"
msgid "\"Unlink your account from #{scheme.description}. You can link again at any time.\""
@@ -244,6 +240,9 @@
msgid "API Information"
msgstr ""
+msgid "API rights"
+msgstr ""
+
msgid "API token"
msgstr ""
@@ -304,6 +303,22 @@
msgid "All the best,"
msgstr ""
+#, fuzzy
+msgid "Allows the user to amend the organisation details (name, URL etc) and add basic branding such as the logo"
+msgstr "Organisation"
+
+#, fuzzy
+msgid "Allows the user to assign permissions to other users within the same organisation. Users can only assign permissions they own themselves"
+msgstr "Organisation"
+
+#, fuzzy
+msgid "Allows the user to create and edit guidance"
+msgstr "user"
+
+#, fuzzy
+msgid "Allows the user to create new institutional templates, edit existing ones and customise funder templates"
+msgstr "templates"
+
msgid "An error has occurred while saving/resetting your export settings."
msgstr ""
@@ -322,10 +337,6 @@
msgstr "Réponse "
#, fuzzy
-msgid "Answered "
-msgstr "Réponse "
-
-#, fuzzy
msgid "Answered at"
msgstr "Réponse "
@@ -383,12 +394,20 @@
msgid "Cancel"
msgstr "Annuler"
+#, fuzzy
+msgid "Cannot share plan with %{email} since that email matches with the owner of the plan."
+msgstr "plans"
+
msgid "Change language"
msgstr ""
msgid "Change my password"
msgstr ""
+#, fuzzy
+msgid "Change organisation details"
+msgstr "Organisation"
+
msgid "Check box"
msgstr "Case à cocher"
@@ -639,12 +658,19 @@
msgid "Grant number"
msgstr "Titre de la subvention"
+msgid "Grant permissions"
+msgstr ""
+
msgid "Grant reference number if applicable [POST-AWARD DMPs ONLY]"
msgstr "N° de réféence de la subvention, le cas échéant (UNIQUEMENT POUR LES DMP CRÉÉS APRÈS OCTROI DUNE SUBVENTION)"
msgid "Guidance"
msgstr "Conseils"
+#, fuzzy
+msgid "Guidance choices saved."
+msgstr "Conseils"
+
msgid "Guidance group"
msgstr "Groupe de conseils"
@@ -722,9 +748,6 @@
msgid "If you would like to change your password please complete the following fields."
msgstr ""
-msgid "Impossible sharing plan with %{email} since that email matches with the owner of the plan."
-msgstr ""
-
msgid "Included Elements"
msgstr "Éléments inclus"
@@ -749,7 +772,7 @@
msgid "Invalid maximum pages"
msgstr "Nombre de pages maxi non valide"
-msgid "Invitation issued successfully."
+msgid "Invitation to %{email} issued successfully."
msgstr ""
msgid "Language"
@@ -798,6 +821,14 @@
msgid "Message"
msgstr "Moi"
+#, fuzzy
+msgid "Modify guidance"
+msgstr "Ajoutez des conseils"
+
+#, fuzzy
+msgid "Modify templates"
+msgstr "templates"
+
msgid "Multi select box"
msgstr "Boîte de sélections multiples"
@@ -967,9 +998,15 @@
msgid "Plan details"
msgstr "Détails du plan"
+msgid "Plan is already shared with %{email}."
+msgstr ""
+
msgid "Plan name"
msgstr "Nom du plan"
+msgid "Plan shared with %{email}."
+msgstr ""
+
#, fuzzy
msgid "Plan was successfully deleted."
msgstr "Création du plan effectuée."
@@ -1057,6 +1094,10 @@
msgid "Project title"
msgstr ""
+#, fuzzy
+msgid "Provides the user with an API token and grants rights to harvest information from the tool"
+msgstr "user"
+
msgid "Public"
msgstr "Public"
@@ -1367,9 +1408,6 @@
msgid "Upload a new logo file"
msgstr ""
-msgid "User added to project"
-msgstr ""
-
msgid "Users"
msgstr "Utilisateurs"
@@ -1659,9 +1697,6 @@
msgid "height must be less than 100px"
msgstr ""
-msgid "helpers.dropdown"
-msgstr ""
-
msgid "helpers.is_test"
msgstr ""
diff --git a/config/locales/devise/devise.en_GB.yml b/config/locales/devise/devise.en_GB.yml
index 5de51ca..3961e3b 100644
--- a/config/locales/devise/devise.en_GB.yml
+++ b/config/locales/devise/devise.en_GB.yml
@@ -11,6 +11,7 @@
inactive: "Your account was not activated yet."
invalid: "Invalid email or password."
invalid_token: "Invalid authentication token."
+ invited: "You have a pending invitation, accept it to finish creating your account."
locked: "Your account is locked."
not_found_in_database: "Invalid email or password."
timeout: "Your session expired, please sign in again to continue."
diff --git a/config/locales/devise/devise.en_US.yml b/config/locales/devise/devise.en_US.yml
index 115e833..826ae0f 100644
--- a/config/locales/devise/devise.en_US.yml
+++ b/config/locales/devise/devise.en_US.yml
@@ -11,6 +11,7 @@
inactive: "Your account was not activated yet."
invalid: "Invalid email or password."
invalid_token: "Invalid authentication token."
+ invited: "You have a pending invitation, accept it to finish creating your account."
locked: "Your account is locked."
not_found_in_database: "Invalid email or password."
timeout: "Your session expired, please sign in again to continue."
diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb
index 9b4eb29..7937867 100644
--- a/test/functional/roles_controller_test.rb
+++ b/test/functional/roles_controller_test.rb
@@ -9,9 +9,8 @@
scaffold_org_admin(@plan.template.org)
# This should NOT be unnecessary! Owner should have full access
- Role.create(user: @user, plan: @plan, access: 15)
+ @plan.roles << Role.create(user: @user, plan: @plan, access: 15)
- @invitee = User.last
end
# TODO: Cleanup routes for this one. The controller currently only responds to create, update, destroy
@@ -26,21 +25,49 @@
# POST /roles (roles_path)
# ----------------------------------------------------------
test "create a new role" do
+
params = {plan_id: @plan.id, access_level: 4}
# Should redirect user to the root path if they are not logged in!
post roles_path, {role: params}
assert_unauthorized_redirect_to_root_path
-
+
sign_in @user
+ # Known user
+ @invitee = User.where.not(id: [@plan.owner.id, @user.id]).first
post roles_path, {user: @invitee.email, role: params}
- assert_equal _('User added to project'), flash[:notice]
+ assert_equal _('Plan shared with %{email}.') % {email: @invitee.email}, flash[:notice]
assert_response :redirect
assert_redirected_to share_plan_path(@plan)
assert_equal @invitee.id, Role.last.user_id, "expected the record to have been created!"
assert assigns(:role)
-
+
+ # Share to already invited user
+ post roles_path, {user: @invitee.email, role: params}
+ assert_equal _('Plan is already shared with %{email}.') % {email: @invitee.email}, flash[:notice]
+ assert_response :redirect
+ assert_redirected_to share_plan_path(@plan)
+ assert_equal @invitee.id, Role.last.user_id, "expected no record to have been created!"
+ assert assigns(:role)
+
+ # Unknown user
+ post roles_path, {user: 'unknown_user@org.org', role: params}
+ assert_equal _('Invitation to unknown_user@org.org issued successfully.'), flash[:notice]
+ assert_response :redirect
+ assert_redirected_to share_plan_path(@plan)
+ assert_equal User.find_by(email:'unknown_user@org.org').id, Role.last.user_id, "expected the record to have been created!"
+ assert assigns(:role)
+
+ # Invite owner
+ @invitee = User.find_by(id: @plan.owner.id)
+ post roles_path, {user: @invitee.email, role: params}
+ assert_equal _('Cannot share plan with %{email} since that email matches with the owner of the plan.') % {email: @invitee.email}, flash[:notice]
+ assert_response :redirect
+ assert_redirected_to share_plan_path(@plan)
+ assert_not_equal @invitee.id, Role.last.user_id, "expected no record to have been created!"
+ assert assigns(:role)
+
# Missing email
post roles_path, {role: {plan_id: @plan.id, access_level: 4}}
assert_equal _('Please enter an email address'), flash[:notice]
@@ -52,6 +79,7 @@
# PUT /role/:id (role_path)
# ----------------------------------------------------------
test "update the role" do
+ @invitee = User.last
role = Role.create(user: @invitee, plan: @plan, access: 1)
params = {access_level: 2}
@@ -81,6 +109,7 @@
# DELETE /role/:id (role_path)
# ----------------------------------------------------------
test "delete the section" do
+ @invitee = User.last
role = Role.create(user: @invitee, plan: @plan, access: 1)
# Should redirect user to the root path if they are not logged in!
@@ -98,4 +127,4 @@
end
end
-end
\ No newline at end of file
+end
|