diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-09-26 15:02:09 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-10-05 13:18:11 +0200 |
commit | d901a2ade4aee181ba26d2e1522201cf09ce40d5 (patch) | |
tree | a841ccd5763566aa431af739d60218f389e89f3a /server/sonar-web/src/main | |
parent | a10d6281091b8b503658eb3cf7172359a18e18cc (diff) | |
download | sonarqube-d901a2ade4aee181ba26d2e1522201cf09ce40d5.tar.gz sonarqube-d901a2ade4aee181ba26d2e1522201cf09ce40d5.zip |
Remove ruby dead code related to users
Diffstat (limited to 'server/sonar-web/src/main')
5 files changed, 0 insertions, 188 deletions
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<<default_group if default_group - end - self.active = true - save! - end - def self.find_active_by_login(login) User.first(:conditions => ["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| %> - <fieldset> - <div class="modal-head"> - <h2>Change password for user: <%= h @user.login -%></h2> - </div> - <div class="modal-body"> - <% if @errors - @errors.each do |error| - %> - <p class="error"><%= h error -%></p> - <% end - end - %> - <div class="modal-field"> - <% if @user.id %> - <%= f.hidden_field :login %> - <% else %> - <%= f.text_field :login, :size => 30, :maxLength => 255 %> - <% end %> - </div> - <div class="modal-field"><label for="user[password]">New password <em class="mandatory">*</em></label><%= f.password_field :password, :size => 30, :maxLength => 50, :autocomplete => 'off' %></div> - <div class="modal-field"><label for="user[password_confirmation]">Confirm password <em class="mandatory">*</em></label><%= f.password_field :password_confirmation, :size => 30, :maxLength => 50, :autocomplete => 'off' %></div> - - </div> - <div class="modal-foot"> - <%= submit_tag 'Save' %> - <%= link_to 'Cancel', { :controller => 'users', :action => 'index'}, { :class => 'action' } %><br/> - </div> - </fieldset> -<% end %> - -<script> - $j("#user_form").modalForm(); -</script> 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 @@ -<form id="user_edit_form" method="post" action="<%= ApplicationController.root_context -%>/users/update"> -<fieldset> - <div class="modal-head"> - <h2>Edit user: <%= h @user.login() -%></h2> - </div> - <div class="modal-body"> - <div class="modal-error"></div> - <div class="modal-field"> - <input type="hidden" value="<%= @user.login() %>" name="user[login]" id="user_login"/> - </div> - <div class="modal-field"> - <label for="user[]">Name<em class="mandatory">*</em></label> - <input type="text" value="<%= @user.name() %>" size="30" name="user[name]" maxlength="200" id="user_name"/> - </div> - <div class="modal-field"> - <label for="user[]">Email</label> - <input type="text" value="<%= @user.email() %>" size="30" name="user[email]" maxlength="100" id="user_email"> - </div> - <div class="modal-field"> - <label for="user[scm_accounts]">SCM accounts</label> - <table> - <% scmAccounts = @user.scmAccounts().to_a %> - <% if scmAccounts.empty? %> - <tr class="scm_account"> - <td> - <input id="user_scm_accounts" type="text" size="30" name="user[scm_accounts][]"/> - </td> - </tr> - <% else %> - <tr class="scm_account"> - <td> - <input id="user_scm_accounts" value="<%= scmAccounts.first() %>" type="text" size="30" name="user[scm_accounts][]"/> - </td> - </tr> - <% - scmAccounts.shift - scmAccounts.each do |scmAccount| %> - <tr class="scm_account"> - <td> - <input id="user_scm_accounts" value="<%= scmAccount %>" type="text" size="30" name="user[scm_accounts][]"/> - <a href="#" class="delete link-action"><%= message('delete') -%></a> - </td> - </tr> - <% end %> - <% end %> - <tr class="scm_account template" style="display:none"> - <td> - <input id="user_scm_accounts" type="text" size="30" name="user[scm_accounts][]"/> - <a href="#" class="delete link-action"><%= message('delete') -%></a> - <br/> - </td> - </tr> - </table> - <div class="note marginbottom10">Note that login and email are automatically considered as SCM accounts</div> - <button class="add_value"><%= message('user.add_scm_account') -%></button> - </div> - </div> - <div class="modal-foot"> - <input type="submit" value="Save" name="commit"> - <a class="action" href="#" onclick="return closeModalWindow()"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> - -<script> - $j("#user_edit_form").modalForm(); - - $j('#user_edit_form .delete').click(function () { - $j(this).parents('.scm_account').remove(); - return false; - }); - - $j('#user_edit_form .add_value').click(function () { - var template = $j(this).parents('#user_edit_form').find('.template').last(); - template.clone().insertBefore(template).show(); - return false; - }); -</script> 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 @@ -<div class="modal-head"> - <h2>User: <%= h @user.login -%></h2> -</div> - -<div class="modal-body"> - <div id="select-list-user"></div> -</div> - -<div class="modal-foot"> - <%= link_to 'Close', { :controller => 'users', :action => 'index', :id => nil}, { :class => 'action' } %><br/> -</div> - -<script> - var selectList = new SelectList({ - el: '#select-list-user', - width: '100%', - format: function (item) { - var label = item.name; - if (item.description) { - label += ' <div class="note">' + item.description + '</div>' - } - return label; - }, - searchUrl: window.baseUrl + '/user_groups/search?user=<%= @user.login -%>', - selectUrl: window.baseUrl + '/groups/add_member', - deselectUrl: window.baseUrl + '/groups/remove_member', - extra: { - user: '<%= @user.login -%>' - }, - selectParameter: 'group', - selectParameterValue: 'name', - labels: { - selected: 'Member of', - deselected: 'Not member of', - all: 'All' - }, - tooltips: { - select: 'Click to add user <%= h @user.login -%> to the group', - deselect: 'Click to remove user <%= h @user.login -%> from the group' - } - }); -</script> |