Ability to allow non-admin users to create projects (#1007).
This can be enabled in permissions settings. A non-admin user who creates a project is automatically added as a project member (the first role is given, TODO: make this given role configurable). Projects can be added from the public projects list. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2750 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -277,6 +277,9 @@ class User < ActiveRecord::Base
|
||||
roles.detect {|role| (project.is_public? || role.member?) && role.allowed_to?(action)}
|
||||
|
||||
elsif options[:global]
|
||||
# Admin users are always authorized
|
||||
return true if admin?
|
||||
|
||||
# authorize if user has at least one role that has this permission
|
||||
roles = memberships.collect {|m| m.roles}.flatten.uniq
|
||||
roles.detect {|r| r.allowed_to?(action)} || (self.logged? ? Role.non_member.allowed_to?(action) : Role.anonymous.allowed_to?(action))
|
||||
|
||||
Reference in New Issue
Block a user