From d901a2ade4aee181ba26d2e1522201cf09ce40d5 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 26 Sep 2016 15:02:09 +0200 Subject: Remove ruby dead code related to users --- .../src/main/webapp/WEB-INF/app/models/group.rb | 12 ---- .../src/main/webapp/WEB-INF/app/models/user.rb | 22 ------ .../app/views/users/_change_password_form.html.erb | 34 ---------- .../WEB-INF/app/views/users/_edit_form.html.erb | 78 ---------------------- .../WEB-INF/app/views/users/_select_group.html.erb | 42 ------------ 5 files changed, 188 deletions(-) delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_change_password_form.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_select_group.html.erb (limited to 'server/sonar-web/src/main') diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/group.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/group.rb index 6138ac9aed0..47a32035f76 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/group.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/group.rb @@ -21,22 +21,10 @@ class Group < ActiveRecord::Base ANYONE = 'anyone' - has_and_belongs_to_many :users, :uniq => true - has_many :group_roles, :dependent => :delete_all - - validates_presence_of :name - validates_length_of :name, :within => 1..255 - validates_length_of :description, :maximum => 200, :allow_blank => true - validates_uniqueness_of :name - validate :name_cant_be_anyone - def <=>(other) return -1 if name.nil? return 1 if other.nil? || other.name.nil? name.downcase<=>other.name.downcase end - def name_cant_be_anyone - errors.add(:name, 'cannot be "Anyone" as this is a reserved group name.') if name && name.downcase == ANYONE - end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/user.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/user.rb index 4575d7a5722..0bb1010d6d7 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/user.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/user.rb @@ -92,34 +92,12 @@ class User < ActiveRecord::Base new_scm_accounts end - def available_groups - Group.all - self.groups - end - - def set_groups(new_groups=[]) - self.groups.clear - - new_groups=(new_groups || []).compact.uniq - self.groups = Group.find(new_groups) - save - end - def <=>(other) return -1 if name.nil? return 1 if other.name.nil? name.downcase<=>other.name.downcase end - # SONAR-3258 - def reactivate!(default_group_name) - if default_group_name - default_group=Group.find_by_name(default_group_name) - self.groups< ["login=:login AND active=:active", {:login => login, :active => true}]) end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_change_password_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_change_password_form.html.erb deleted file mode 100644 index fd723a0e274..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_change_password_form.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<% form_for :user, @user, :url => { :id => @user.id, :action => 'update_password'}, :html => { :id =>'user_form', :method => @user.id.nil? ? :post : :put} do |f| %> -
- - - -
-<% end %> - - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb deleted file mode 100644 index 17fc622e600..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb +++ /dev/null @@ -1,78 +0,0 @@ -
-
- - - -
-
- - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_select_group.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_select_group.html.erb deleted file mode 100644 index 73d98802573..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/users/_select_group.html.erb +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -- cgit v1.2.3