diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5f508cb5..355e1bd4 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -78,7 +78,8 @@ class ProjectsController < ApplicationController @project.set_parent!(params[:project]['parent_id']) if User.current.admin? && params[:project].has_key?('parent_id') # Add current user as a project member if he is not admin unless User.current.admin? - m = Member.new(:user => User.current, :roles => Role.builtin(false).find(:all, :order => 'position', :limit => 1)) + r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first + m = Member.new(:user => User.current, :roles => [r]) @project.members << m end flash[:notice] = l(:notice_successful_create) diff --git a/app/models/role.rb b/app/models/role.rb index a93c4eac..db582570 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -20,6 +20,7 @@ class Role < ActiveRecord::Base BUILTIN_NON_MEMBER = 1 BUILTIN_ANONYMOUS = 2 + named_scope :givable, { :conditions => "builtin = 0", :order => 'position' } named_scope :builtin, lambda { |*args| compare = 'not' if args.first == true { :conditions => "#{compare} builtin = 0" } diff --git a/app/views/settings/_projects.rhtml b/app/views/settings/_projects.rhtml index 1cd4f6e9..510807d9 100644 --- a/app/views/settings/_projects.rhtml +++ b/app/views/settings/_projects.rhtml @@ -6,6 +6,9 @@

<%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %><%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %>

+ +

+<%= select_tag('settings[new_project_user_role_id]', options_for_select([["--- #{l(:actionview_instancetag_blank_option)} ---", '']] + Role.find_all_givable.collect {|r| [r.name, r.id]}, Setting.new_project_user_role_id)) %>

<%= submit_tag l(:button_save) %> diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 4a18f493..530b8f96 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -797,3 +797,4 @@ bg: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 841a5675..d9cef694 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -830,3 +830,4 @@ bs: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/ca.yml b/config/locales/ca.yml index a209a1e5..de805a2b 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -800,3 +800,4 @@ ca: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/cs.yml b/config/locales/cs.yml index cae51f95..765b8a88 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -803,3 +803,4 @@ cs: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/da.yml b/config/locales/da.yml index f388fc8c..430130f1 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -830,3 +830,4 @@ da: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/de.yml b/config/locales/de.yml index a6f56a2a..0ebcba07 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -829,3 +829,4 @@ de: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/en.yml b/config/locales/en.yml index 9cfc0b1d..69f7c767 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -291,6 +291,7 @@ en: setting_repository_log_display_limit: Maximum number of revisions displayed on file log setting_openid: Allow OpenID login and registration setting_password_min_length: Minimum password length + setting_new_project_user_role_id: Role given to a non-admin user who creates a project permission_add_project: Create project permission_edit_project: Edit project diff --git a/config/locales/es.yml b/config/locales/es.yml index 783d2b5c..58887ac6 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -850,3 +850,4 @@ es: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 1f2f86c8..fdd97f0c 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -840,3 +840,4 @@ fi: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ce9c2f77..e36b4ed5 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -323,6 +323,7 @@ fr: setting_repository_log_display_limit: "Nombre maximum de revisions affichées sur l'historique d'un fichier" setting_openid: "Autoriser l'authentification et l'enregistrement OpenID" setting_password_min_length: Longueur minimum des mots de passe + setting_new_project_user_role_id: Rôle donné à un utilisateur non-administrateur qui crée un projet permission_add_project: Créer un projet permission_edit_project: Modifier le projet diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 0f619adb..b6c97de9 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -829,3 +829,4 @@ gl: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/he.yml b/config/locales/he.yml index d3b9bf0e..8984a27e 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -812,3 +812,4 @@ he: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 1719562b..25711bc7 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -835,3 +835,4 @@ label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/it.yml b/config/locales/it.yml index 721d72c4..986d4b60 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -815,3 +815,4 @@ it: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/ja.yml b/config/locales/ja.yml index b00e9f2f..e9d2a708 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -828,3 +828,4 @@ ja: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/ko.yml b/config/locales/ko.yml index b8cffa40..833ddb53 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -859,3 +859,4 @@ ko: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 3b2776d1..acc1197d 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -840,3 +840,4 @@ lt: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 8c0a59ea..7eed1a52 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -785,3 +785,4 @@ nl: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/no.yml b/config/locales/no.yml index a481d491..0d99ce44 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -802,3 +802,4 @@ label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/pl.yml b/config/locales/pl.yml index c575101a..1fed951b 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -833,3 +833,4 @@ pl: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 16b151bf..05ccdc92 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -835,3 +835,4 @@ pt-BR: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/pt.yml b/config/locales/pt.yml index ea40131c..f8ef1c8a 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -821,3 +821,4 @@ pt: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 7d61ffb1..966f1d95 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -800,3 +800,4 @@ ro: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/ru.yml b/config/locales/ru.yml index f2274db9..c66d47db 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -927,3 +927,4 @@ ru: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 2647fbfd..12aad3bf 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -802,3 +802,4 @@ sk: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. setting_repositories_encodings: Repositories encodings + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 676f744f..76ee8ef7 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -799,3 +799,4 @@ sl: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 8c6a753a..9c984aed 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -823,3 +823,4 @@ label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 8912bb7c..3cc2380d 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -857,3 +857,4 @@ sv: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/th.yml b/config/locales/th.yml index 2f5bc740..12fdd9c9 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -800,3 +800,4 @@ th: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 4ab55429..a75f7bc7 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -836,3 +836,4 @@ tr: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 5a7da7e7..acf233ed 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -799,3 +799,4 @@ uk: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/vi.yml b/config/locales/vi.yml index d6885501..c628d60f 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -869,3 +869,4 @@ vi: label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. permission_add_project: Create project + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index b1383847..e48639f6 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -907,3 +907,4 @@ permission_add_project: Create project label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 1c1f8a50..5af59343 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -832,3 +832,4 @@ zh: permission_add_project: Create project label_wiki_content_updated: Wiki page updated mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. + setting_new_project_user_role_id: Role given to a non-admin user who creates a project diff --git a/config/settings.yml b/config/settings.yml index 5d4d6ff1..e0950c51 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -131,6 +131,10 @@ display_subprojects_issues: default: 1 default_projects_public: default: 1 +# Role given to a non-admin user who creates a project +new_project_user_role_id: + format: int + default: '' sequential_project_identifiers: default: 0 # encodings used to convert repository files content to UTF-8