Commit fc6b1c6b authored by jplang's avatar jplang

Adds a setting to choose which role is given to a non-admin user who creates a project (#1007).

git-svn-id: https://svn.redmine.org/redmine/trunk@2754 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent bb190f6e
......@@ -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)
......
......@@ -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" }
......
......@@ -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) %>
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......
......@@ -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
......@@ -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
......@@ -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
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment