Commit fd1661468f8132800dec17ad9317d419b1440f5a

Authored by Dmitriy Zaporozhets
1 parent 606701ad

Remove can_create_team code from user

app/controllers/application_controller.rb
1 -class ApplicationController < ActionController::Base  
2 before_filter :authenticate_user! 1 before_filter :authenticate_user!
3 before_filter :reject_blocked! 2 before_filter :reject_blocked!
4 before_filter :check_password_expiration 3 before_filter :check_password_expiration
@@ -95,10 +94,6 @@ class ApplicationController &lt; ActionController::Base @@ -95,10 +94,6 @@ class ApplicationController &lt; ActionController::Base
95 return access_denied! unless can?(current_user, :push_code, project) 94 return access_denied! unless can?(current_user, :push_code, project)
96 end 95 end
97 96
98 - def authorize_create_team!  
99 - return access_denied! unless can?(current_user, :create_team, nil)  
100 - end  
101 -  
102 def access_denied! 97 def access_denied!
103 render "errors/access_denied", layout: "errors", status: 404 98 render "errors/access_denied", layout: "errors", status: 404
104 end 99 end
app/models/user.rb
@@ -47,7 +47,7 @@ class User &lt; ActiveRecord::Base @@ -47,7 +47,7 @@ class User &lt; ActiveRecord::Base
47 :extern_uid, :provider, :password_expires_at, 47 :extern_uid, :provider, :password_expires_at,
48 as: [:default, :admin] 48 as: [:default, :admin]
49 49
50 - attr_accessible :projects_limit, :can_create_team, :can_create_group, 50 + attr_accessible :projects_limit, :can_create_group,
51 as: :admin 51 as: :admin
52 52
53 attr_accessor :force_random_password 53 attr_accessor :force_random_password
@@ -208,7 +208,6 @@ class User &lt; ActiveRecord::Base @@ -208,7 +208,6 @@ class User &lt; ActiveRecord::Base
208 tap do |u| 208 tap do |u|
209 u.projects_limit = Gitlab.config.gitlab.default_projects_limit 209 u.projects_limit = Gitlab.config.gitlab.default_projects_limit
210 u.can_create_group = Gitlab.config.gitlab.default_can_create_group 210 u.can_create_group = Gitlab.config.gitlab.default_can_create_group
211 - u.can_create_team = Gitlab.config.gitlab.default_can_create_team  
212 u.theme_id = Gitlab::Theme::MARS 211 u.theme_id = Gitlab::Theme::MARS
213 end 212 end
214 end 213 end
app/views/admin/users/_form.html.haml
@@ -57,10 +57,6 @@ @@ -57,10 +57,6 @@
57 .controls= f.check_box :can_create_group 57 .controls= f.check_box :can_create_group
58 58
59 .control-group 59 .control-group
60 - = f.label :can_create_team  
61 - .controls= f.check_box :can_create_team  
62 -  
63 - .control-group  
64 = f.label :admin do 60 = f.label :admin do
65 %strong.cred Administrator 61 %strong.cred Administrator
66 .controls= f.check_box :admin 62 .controls= f.check_box :admin
config/gitlab.yml.example
@@ -41,7 +41,6 @@ production: &amp;base @@ -41,7 +41,6 @@ production: &amp;base
41 ## User settings 41 ## User settings
42 default_projects_limit: 10 42 default_projects_limit: 10
43 # default_can_create_group: false # default: true 43 # default_can_create_group: false # default: true
44 - # default_can_create_team: false # default: true  
45 # username_changing_enabled: false # default: true - User can change her username/namespace 44 # username_changing_enabled: false # default: true - User can change her username/namespace
46 45
47 ## Users management 46 ## Users management
config/initializers/1_settings.rb
@@ -52,7 +52,6 @@ Settings[&#39;issues_tracker&#39;] ||= {} @@ -52,7 +52,6 @@ Settings[&#39;issues_tracker&#39;] ||= {}
52 Settings['gitlab'] ||= Settingslogic.new({}) 52 Settings['gitlab'] ||= Settingslogic.new({})
53 Settings.gitlab['default_projects_limit'] ||= 10 53 Settings.gitlab['default_projects_limit'] ||= 10
54 Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil? 54 Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil?
55 -Settings.gitlab['default_can_create_team'] = true if Settings.gitlab['default_can_create_team'].nil?  
56 Settings.gitlab['host'] ||= 'localhost' 55 Settings.gitlab['host'] ||= 'localhost'
57 Settings.gitlab['https'] = false if Settings.gitlab['https'].nil? 56 Settings.gitlab['https'] = false if Settings.gitlab['https'].nil?
58 Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 57 Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80