diff options
38 files changed, 44 insertions, 1 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5f508cb5f..355e1bd46 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 a93c4eaca..db5825702 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 1cd4f6e9b..510807d99 100644 --- a/app/views/settings/_projects.rhtml +++ b/app/views/settings/_projects.rhtml @@ -6,6 +6,9 @@ <p><label><%= l(:setting_sequential_project_identifiers) %></label> <%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %><%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %></p> + +<p><label><%= l(:setting_new_project_user_role_id) %></label> +<%= 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)) %></p> </div> <%= submit_tag l(:button_save) %> diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 4a18f4939..530b8f96f 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 841a56759..d9cef694d 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 a209a1e5a..de805a2bd 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 cae51f951..765b8a883 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 f388fc8c5..430130f1c 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 a6f56a2af..0ebcba077 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 9cfc0b1dd..69f7c767f 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 783d2b5c1..58887ac6f 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 1f2f86c89..fdd97f0c8 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 ce9c2f776..e36b4ed53 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 0f619adb6..b6c97de9d 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 d3b9bf0ec..8984a27e3 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 1719562b0..25711bc74 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 721d72c47..986d4b60c 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 b00e9f2f7..e9d2a708f 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 b8cffa400..833ddb532 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 3b2776d1b..acc1197d4 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 8c0a59ea5..7eed1a52a 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 a481d4912..0d99ce442 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 c575101ae..1fed951ba 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 16b151bf7..05ccdc92f 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 ea40131c3..f8ef1c8a6 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 7d61ffb10..966f1d953 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 f2274db97..c66d47db0 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 2647fbfd5..12aad3bf5 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 676f744ff..76ee8ef7a 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 8c6a753a0..9c984aed7 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 8912bb7cd..3cc2380dd 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 2f5bc7404..12fdd9c9c 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 4ab554291..a75f7bc72 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 5a7da7e77..acf233edb 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 d6885501b..c628d60f6 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 b13838478..e48639f6f 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 1c1f8a509..5af59343c 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 5d4d6ff14..e0950c510 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 |