diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-05-05 22:15:48 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-05-05 22:54:26 +0200 |
commit | 09582321164657872f5b3c38afb2473f449210e0 (patch) | |
tree | 940c0948d65c7bcc6f0dac386d67ad850e8b4575 | |
parent | 11e5756c62a86d6844bc46dda3066986899c880c (diff) | |
download | sonarqube-09582321164657872f5b3c38afb2473f449210e0.tar.gz sonarqube-09582321164657872f5b3c38afb2473f449210e0.zip |
SONAR-5273 Increase maximal size of user login to 255 characters
12 files changed, 76 insertions, 20 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index ddda96bf237..c76a886736b 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -33,7 +33,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 531; + public static final int LAST_VERSION = 532; public static enum Status { UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index b1a4dd82bb5..b45f1705b25 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -227,6 +227,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('525'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('526'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('530'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('531'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('532'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index 4b1234367c9..1e78c753b0b 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -145,7 +145,7 @@ CREATE TABLE "RULES" ( "STATUS" VARCHAR(40), "LANGUAGE" VARCHAR(20), "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_LOGIN" VARCHAR(40), + "NOTE_USER_LOGIN" VARCHAR(255), "NOTE_CREATED_AT" TIMESTAMP, "NOTE_UPDATED_AT" TIMESTAMP, "CHARACTERISTIC_ID" INTEGER, @@ -238,7 +238,7 @@ CREATE TABLE "DUPLICATIONS_INDEX" ( CREATE TABLE "ACTIVE_RULE_CHANGES" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USERNAME" VARCHAR(200), + "USERNAME" VARCHAR(255), "PROFILE_ID" INTEGER NOT NULL, "PROFILE_VERSION" INTEGER NOT NULL, "RULE_ID" INTEGER NOT NULL, @@ -304,7 +304,7 @@ CREATE TABLE "MANUAL_MEASURES" ( "RESOURCE_ID" INTEGER, "VALUE" DOUBLE, "TEXT_VALUE" VARCHAR(4000), - "USER_LOGIN" VARCHAR(40), + "USER_LOGIN" VARCHAR(255), "DESCRIPTION" VARCHAR(4000), "CREATED_AT" TIMESTAMP, "UPDATED_AT" TIMESTAMP @@ -351,7 +351,7 @@ CREATE TABLE "ACTIVE_RULE_PARAMETERS" ( CREATE TABLE "USERS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "LOGIN" VARCHAR(40), + "LOGIN" VARCHAR(255), "NAME" VARCHAR(200), "EMAIL" VARCHAR(100), "CRYPTED_PASSWORD" VARCHAR(40), @@ -416,7 +416,7 @@ CREATE TABLE "ACTION_PLANS" ( "NAME" VARCHAR(200), "DESCRIPTION" VARCHAR(1000), "DEADLINE" TIMESTAMP, - "USER_LOGIN" VARCHAR(40), + "USER_LOGIN" VARCHAR(255), "PROJECT_ID" INTEGER, "STATUS" VARCHAR(10), "CREATED_AT" TIMESTAMP, @@ -486,9 +486,9 @@ CREATE TABLE "ISSUES" ( "STATUS" VARCHAR(20), "RESOLUTION" VARCHAR(20), "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(40), - "ASSIGNEE" VARCHAR(40), - "AUTHOR_LOGIN" VARCHAR(100), + "REPORTER" VARCHAR(255), + "ASSIGNEE" VARCHAR(255), + "AUTHOR_LOGIN" VARCHAR(255), "ACTION_PLAN_KEY" VARCHAR(50) NULL, "ISSUE_ATTRIBUTES" VARCHAR(4000), "ISSUE_CREATION_DATE" TIMESTAMP, @@ -502,7 +502,7 @@ CREATE TABLE "ISSUE_CHANGES" ( "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "KEE" VARCHAR(50), "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(40), + "USER_LOGIN" VARCHAR(255), "CHANGE_TYPE" VARCHAR(40), "CHANGE_DATA" VARCHAR(16777215), "CREATED_AT" TIMESTAMP, @@ -514,7 +514,7 @@ CREATE TABLE "ISSUE_FILTERS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(100) NOT NULL, "SHARED" BOOLEAN NOT NULL DEFAULT FALSE, - "USER_LOGIN" VARCHAR(40), + "USER_LOGIN" VARCHAR(255), "DESCRIPTION" VARCHAR(4000), "DATA" CLOB(2147483647), "CREATED_AT" TIMESTAMP, @@ -523,7 +523,7 @@ CREATE TABLE "ISSUE_FILTERS" ( CREATE TABLE "ISSUE_FILTER_FAVOURITES" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USER_LOGIN" VARCHAR(40) NOT NULL, + "USER_LOGIN" VARCHAR(255) NOT NULL, "ISSUE_FILTER_ID" INTEGER NOT NULL, "CREATED_AT" TIMESTAMP ); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/User.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/User.java index 56e277f62be..15fce83fd9c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/User.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/User.java @@ -34,7 +34,7 @@ import javax.persistence.Table; @Table(name = "users") public class User extends BaseIdentifiable { - @Column(name = "login", updatable = true, nullable = true, length = 40) + @Column(name = "login", updatable = true, nullable = true, length = 255) private String login; @Column(name = "name", updatable = true, nullable = true, length = 200) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/author.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/author.rb index 612b06a9cb1..1db85053c31 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/author.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/author.rb @@ -23,7 +23,7 @@ class Author < ActiveRecord::Base validates_uniqueness_of :login validates_presence_of :person - validates_length_of :login, :allow_blank => false, :maximum => 100 + validates_length_of :login, :allow_blank => false, :maximum => 255 def <=>(other) login<=>other.login diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb index 8d1131c0f6f..39325bd9b13 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb @@ -53,7 +53,7 @@ class User < ActiveRecord::Base #validates_confirmation_of :password, :if => :password_required? validates_presence_of :login - validates_length_of :login, :within => 2..40 + validates_length_of :login, :within => 2..255 validates_uniqueness_of :login, :case_sensitive => true validates_format_of :login, :with => Authentication.login_regex, :message => Authentication.bad_login_message diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb index 0f4240aac39..0382575d0e2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb @@ -6,7 +6,7 @@ <input type="hidden" name="return_to_anchor" value=""> <h3><%= label_tag message('login') %></h3> <p> - <%= text_field_tag 'login', '', {:maxlength => 40, :disabled => false, :style => 'width:200px;'} %> + <%= text_field_tag 'login', '', {:maxlength => 255, :disabled => false, :style => 'width:200px;'} %> <% if Property.value('sonar.allowUsersToSignUp')=='true' %> <br/><span class="desc"><%= message('sessions.new_account', :params => [url_for(:controller => 'users', :action => 'new')]) -%></span> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb index 39ce5566640..121fa5f9f35 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb @@ -10,7 +10,7 @@ <h3><%= label_tag message('login') %></h3> <p> - <%= text_field_tag 'login', '', {:maxlength => 40, :disabled => false, :style => 'width:200px;'} %> + <%= text_field_tag 'login', '', {:maxlength => 255, :disabled => false, :style => 'width:200px;'} %> <% if Property.value('sonar.allowUsersToSignUp')=='true' %> <br/><span class="desc"><%= message('sessions.new_account', :params => [url_for(:controller => 'users', :action => 'new')]) -%></span> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/users/_change_password_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/users/_change_password_form.html.erb index 0d91a35087c..fd723a0e274 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/users/_change_password_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/users/_change_password_form.html.erb @@ -15,7 +15,7 @@ <% if @user.id %> <%= f.hidden_field :login %> <% else %> - <%= f.text_field :login, :size => 30, :maxLength => 40 %> + <%= 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> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/users/_create_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/users/_create_form.html.erb index a3243167f5a..e1caad17b23 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/users/_create_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/users/_create_form.html.erb @@ -16,7 +16,7 @@ <%= @user.login %> <%= f.hidden_field :login %> <% else %> - <%= f.text_field :login, :size => 30, :maxLength => 40 %> + <%= f.text_field :login, :size => 30, :maxLength => 255 %> <% end %> </div> <div class="modal-field"> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb index c6f408dac0d..d2d963d086b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/users/_edit_form.html.erb @@ -15,7 +15,7 @@ <% if @user.id %> <%= f.hidden_field :login %> <% else %> - <%= f.text_field :login, :size => 30, :maxLength => 40 %> + <%= f.text_field :login, :size => 30, :maxLength => 255 %> <% end %> </div> <div class="modal-field"> diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/532_increase_size_of_user_login.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/532_increase_size_of_user_login.rb new file mode 100644 index 00000000000..76f81b7d3ca --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/532_increase_size_of_user_login.rb @@ -0,0 +1,55 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# SonarQube is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +# +# SonarQube 4.4 +# SONAR-5273 +# +class IncreaseSizeOfUserLogin < ActiveRecord::Migration + + def self.up + if dialect()=='sqlserver' + remove_index :users, :name => 'users_login' + remove_index :users, :name => 'uniq_author_logins' + remove_index :issue_filter_favourites, :name => 'issue_filter_favs_user' + remove_index :issues, :name => 'issues_assignee' + end + + change_column 'action_plans', 'user_login', :string, :null => true, :limit => 255 + change_column 'active_rule_changes', 'username', :string, :limit => 255, :null => true + change_column :authors, 'login', :string, :null => true, :limit => 255 + change_column :issues, :reporter, :string, :null => true, :limit => 255 + change_column :issues, :assignee, :string, :null => true, :limit => 255 + change_column :issues, :author_login, :string, :null => true, :limit => 255 + change_column :issue_filter_favourites, :user_login, :string, :null => false, :limit => 255 + change_column :issue_filters, :user_login, :string, :null => true, :limit => 255 + change_column 'manual_measures', 'user_login', :string, :null => true, :limit => 255 + change_column 'rules', :note_user_login, :string, :null => true, :limit => 255 + change_column :users, :login, :string, :limit => 255, :unique => true + + if dialect()=='sqlserver' + add_index :users, :login, :name => 'users_login' + add_index :authors, :login, :unique => true, :name => 'uniq_author_logins' + add_index :issue_filter_favourites, :user_login, :name => 'issue_filter_favs_user' + add_index :issues, :assignee, :name => 'issues_assignee' + end + end + +end |