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

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2754 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-05-17 14:35:00 +00:00
parent ce8bd16020
commit 52b5b29203
38 changed files with 44 additions and 1 deletions

View File

@ -78,7 +78,8 @@ class ProjectsController < ApplicationController
@project.set_parent!(params[:project]['parent_id']) if User.current.admin? && params[:project].has_key?('parent_id') @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 # Add current user as a project member if he is not admin
unless User.current.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 @project.members << m
end end
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)

View File

@ -20,6 +20,7 @@ class Role < ActiveRecord::Base
BUILTIN_NON_MEMBER = 1 BUILTIN_NON_MEMBER = 1
BUILTIN_ANONYMOUS = 2 BUILTIN_ANONYMOUS = 2
named_scope :givable, { :conditions => "builtin = 0", :order => 'position' }
named_scope :builtin, lambda { |*args| named_scope :builtin, lambda { |*args|
compare = 'not' if args.first == true compare = 'not' if args.first == true
{ :conditions => "#{compare} builtin = 0" } { :conditions => "#{compare} builtin = 0" }

View File

@ -6,6 +6,9 @@
<p><label><%= l(:setting_sequential_project_identifiers) %></label> <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> <%= 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> </div>
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>

View File

@ -797,3 +797,4 @@ bg:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -830,3 +830,4 @@ bs:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -800,3 +800,4 @@ ca:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -803,3 +803,4 @@ cs:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -830,3 +830,4 @@ da:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -829,3 +829,4 @@ de:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -291,6 +291,7 @@ en:
setting_repository_log_display_limit: Maximum number of revisions displayed on file log setting_repository_log_display_limit: Maximum number of revisions displayed on file log
setting_openid: Allow OpenID login and registration setting_openid: Allow OpenID login and registration
setting_password_min_length: Minimum password length 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_add_project: Create project
permission_edit_project: Edit project permission_edit_project: Edit project

View File

@ -850,3 +850,4 @@ es:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -840,3 +840,4 @@ fi:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -323,6 +323,7 @@ fr:
setting_repository_log_display_limit: "Nombre maximum de revisions affichées sur l'historique d'un fichier" 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_openid: "Autoriser l'authentification et l'enregistrement OpenID"
setting_password_min_length: Longueur minimum des mots de passe 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_add_project: Créer un projet
permission_edit_project: Modifier le projet permission_edit_project: Modifier le projet

View File

@ -829,3 +829,4 @@ gl:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -812,3 +812,4 @@ he:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -835,3 +835,4 @@
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -815,3 +815,4 @@ it:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -828,3 +828,4 @@ ja:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -859,3 +859,4 @@ ko:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -840,3 +840,4 @@ lt:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -785,3 +785,4 @@ nl:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -802,3 +802,4 @@
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -833,3 +833,4 @@ pl:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -835,3 +835,4 @@ pt-BR:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -821,3 +821,4 @@ pt:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -800,3 +800,4 @@ ro:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -927,3 +927,4 @@ ru:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -802,3 +802,4 @@ sk:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
setting_repositories_encodings: Repositories encodings setting_repositories_encodings: Repositories encodings
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -799,3 +799,4 @@ sl:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -823,3 +823,4 @@
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -857,3 +857,4 @@ sv:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -800,3 +800,4 @@ th:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -836,3 +836,4 @@ tr:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -799,3 +799,4 @@ uk:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -869,3 +869,4 @@ vi:
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}.
permission_add_project: Create project permission_add_project: Create project
setting_new_project_user_role_id: Role given to a non-admin user who creates a project

View File

@ -907,3 +907,4 @@
permission_add_project: Create project permission_add_project: Create project
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. 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

View File

@ -832,3 +832,4 @@ zh:
permission_add_project: Create project permission_add_project: Create project
label_wiki_content_updated: Wiki page updated label_wiki_content_updated: Wiki page updated
mail_body_wiki_content_updated: The '{{page}}' wiki page has been updated by {{author}}. 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

View File

@ -131,6 +131,10 @@ display_subprojects_issues:
default: 1 default: 1
default_projects_public: default_projects_public:
default: 1 default: 1
# Role given to a non-admin user who creates a project
new_project_user_role_id:
format: int
default: ''
sequential_project_identifiers: sequential_project_identifiers:
default: 0 default: 0
# encodings used to convert repository files content to UTF-8 # encodings used to convert repository files content to UTF-8