Commit e12b6f30 authored by Stan Hu's avatar Stan Hu

Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce

parents e426c149 c8d01fa8
...@@ -40,12 +40,19 @@ class BambooService < CiService ...@@ -40,12 +40,19 @@ class BambooService < CiService
attr_accessor :response attr_accessor :response
after_save :compose_service_hook, if: :activated? after_save :compose_service_hook, if: :activated?
before_update :reset_password
def compose_service_hook def compose_service_hook
hook = service_hook || build_service_hook hook = service_hook || build_service_hook
hook.save hook.save
end end
def reset_password
if prop_updated?(:bamboo_url)
self.password = nil
end
end
def title def title
'Atlassian Bamboo CI' 'Atlassian Bamboo CI'
end end
......
...@@ -37,12 +37,19 @@ class TeamcityService < CiService ...@@ -37,12 +37,19 @@ class TeamcityService < CiService
attr_accessor :response attr_accessor :response
after_save :compose_service_hook, if: :activated? after_save :compose_service_hook, if: :activated?
before_update :reset_password
def compose_service_hook def compose_service_hook
hook = service_hook || build_service_hook hook = service_hook || build_service_hook
hook.save hook.save
end end
def reset_password
if prop_updated?(:teamcity_url)
self.password = nil
end
end
def title def title
'JetBrains TeamCity CI' 'JetBrains TeamCity CI'
end end
......
...@@ -117,6 +117,15 @@ class Service < ActiveRecord::Base ...@@ -117,6 +117,15 @@ class Service < ActiveRecord::Base
end end
end end
# ActiveRecord does not provide a mechanism to track changes in serialized keys.
# This is why we need to perform extra query to do it mannually.
def prop_updated?(prop_name)
relation_name = self.type.underscore
previous_value = project.send(relation_name).send(prop_name)
return false if previous_value.nil?
previous_value != send(prop_name)
end
def async_execute(data) def async_execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
%hr %hr
= form_tag admin_users_path, method: :get, class: 'form-inline' do = form_tag admin_users_path, method: :get, class: 'form-inline' do
.form-group .form-group
= search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'form-control' = search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'form-control', spellcheck: false
= hidden_field_tag "filter", params[:filter] = hidden_field_tag "filter", params[:filter]
= button_tag class: 'btn btn-primary' do = button_tag class: 'btn btn-primary' do
%i.fa.fa-search %i.fa.fa-search
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
.pull-left .pull-left
= form_tag ci_admin_runners_path, id: 'runners-search', class: 'form-inline', method: :get do = form_tag ci_admin_runners_path, id: 'runners-search', class: 'form-inline', method: :get do
.form-group .form-group
= search_field_tag :search, params[:search], class: 'form-control', placeholder: 'Runner description or token' = search_field_tag :search, params[:search], class: 'form-control', placeholder: 'Runner description or token', spellcheck: false
= submit_tag 'Search', class: 'btn' = submit_tag 'Search', class: 'btn'
.pull-right.light .pull-right.light
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
%td %td
= form_tag ci_admin_runner_path(@runner), id: 'runner-projects-search', class: 'form-inline', method: :get do = form_tag ci_admin_runner_path(@runner), id: 'runner-projects-search', class: 'form-inline', method: :get do
.form-group .form-group
= search_field_tag :search, params[:search], class: 'form-control' = search_field_tag :search, params[:search], class: 'form-control', spellcheck: false
= submit_tag 'Search', class: 'btn' = submit_tag 'Search', class: 'btn'
%td %td
......
.projects-list-holder .projects-list-holder
.projects-search-form .projects-search-form
.input-group .input-group
= search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control' = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control', spellcheck: false
- if current_user.can_create_project? - if current_user.can_create_project?
%span.input-group-btn %span.input-group-btn
= link_to new_project_path, class: 'btn btn-green' do = link_to new_project_path, class: 'btn btn-green' do
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
= form_tag explore_groups_path, method: :get, class: 'form-inline form-tiny' do |f| = form_tag explore_groups_path, method: :get, class: 'form-inline form-tiny' do |f|
= hidden_field_tag :sort, @sort = hidden_field_tag :sort, @sort
.form-group .form-group
= search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input", id: "groups_search" = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input", id: "groups_search", spellcheck: false
.form-group .form-group
= button_tag 'Search', class: "btn btn-default" = button_tag 'Search', class: "btn btn-default"
......
.pull-left .pull-left
= form_tag explore_projects_filter_path, method: :get, class: 'form-inline form-tiny' do |f| = form_tag explore_projects_filter_path, method: :get, class: 'form-inline form-tiny' do |f|
.form-group .form-group
= search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input", id: "projects_search" = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input", id: "projects_search", spellcheck: false
.form-group .form-group
= button_tag 'Search', class: "btn btn-success" = button_tag 'Search', class: "btn btn-success"
......
.panel.panel-default.projects-list-holder .panel.panel-default.projects-list-holder
.panel-heading.clearfix .panel-heading.clearfix
.input-group .input-group
= search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control' = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control', spellcheck: false
- if can? current_user, :create_projects, @group - if can? current_user, :create_projects, @group
%span.input-group-btn %span.input-group-btn
= link_to new_project_path(namespace_id: @group.id), class: 'btn btn-green' do = link_to new_project_path(namespace_id: @group.id), class: 'btn btn-green' do
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
.clearfix.js-toggle-container .clearfix.js-toggle-container
= form_tag group_group_members_path(@group), method: :get, class: 'form-inline member-search-form' do = form_tag group_group_members_path(@group), method: :get, class: 'form-inline member-search-form' do
.form-group .form-group
= search_field_tag :search, params[:search], { placeholder: 'Find existing member by name', class: 'form-control search-text-input' } = search_field_tag :search, params[:search], { placeholder: 'Find existing member by name', class: 'form-control search-text-input', spellcheck: false }
= button_tag 'Search', class: 'btn' = button_tag 'Search', class: 'btn'
- if current_user && current_user.can?(:admin_group_member, @group) - if current_user && current_user.can?(:admin_group_member, @group)
......
.search .search
= form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f| = form_tag search_path, method: :get, class: 'navbar-form pull-left' do |f|
= search_field_tag "search", nil, placeholder: search_placeholder, class: "search-input form-control" = search_field_tag "search", nil, placeholder: search_placeholder, class: "search-input form-control", spellcheck: false
= hidden_field_tag :group_id, @group.try(:id) = hidden_field_tag :group_id, @group.try(:id)
- if @project && @project.persisted? - if @project && @project.persisted?
= hidden_field_tag :project_id, @project.id = hidden_field_tag :project_id, @project.id
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
.clearfix.js-toggle-container .clearfix.js-toggle-container
= form_tag namespace_project_project_members_path(@project.namespace, @project), method: :get, class: 'form-inline member-search-form' do = form_tag namespace_project_project_members_path(@project.namespace, @project), method: :get, class: 'form-inline member-search-form' do
.form-group .form-group
= search_field_tag :search, params[:search], { placeholder: 'Find existing member by name', class: 'form-control search-text-input' } = search_field_tag :search, params[:search], { placeholder: 'Find existing member by name', class: 'form-control search-text-input', spellcheck: false }
= button_tag 'Search', class: 'btn' = button_tag 'Search', class: 'btn'
- if can?(current_user, :admin_project_member, @project) - if can?(current_user, :admin_project_member, @project)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.search-holder.clearfix .search-holder.clearfix
.input-group .input-group
= search_field_tag :search, params[:search], placeholder: "Search for projects, issues etc", class: "form-control search-text-input", id: "dashboard_search", autofocus: true = search_field_tag :search, params[:search], placeholder: "Search for projects, issues etc", class: "form-control search-text-input", id: "dashboard_search", autofocus: true, spellcheck: false
%span.input-group-btn %span.input-group-btn
= button_tag 'Search', class: "btn btn-primary" = button_tag 'Search', class: "btn btn-primary"
- unless params[:snippets].eql? 'true' - unless params[:snippets].eql? 'true'
......
= form_tag(path, method: :get, id: "issue_search_form", class: 'pull-left issue-search-form') do = form_tag(path, method: :get, id: "issue_search_form", class: 'pull-left issue-search-form') do
.append-right-10.hidden-xs.hidden-sm .append-right-10.hidden-xs.hidden-sm
= search_field_tag :issue_search, params[:issue_search], { placeholder: 'Filter by title or description', class: 'form-control issue_search search-text-input' } = search_field_tag :issue_search, params[:issue_search], { placeholder: 'Filter by title or description', class: 'form-control issue_search search-text-input', spellcheck: false }
= hidden_field_tag :state, params['state'] = hidden_field_tag :state, params['state']
= hidden_field_tag :scope, params['scope'] = hidden_field_tag :scope, params['scope']
= hidden_field_tag :assignee_id, params['assignee_id'] = hidden_field_tag :assignee_id, params['assignee_id']
......
...@@ -8,31 +8,5 @@ It is possible to add a markdown-formatted welcome message to your GitLab ...@@ -8,31 +8,5 @@ It is possible to add a markdown-formatted welcome message to your GitLab
sign-in page. Users of GitLab Enterprise Edition should use the [branded login sign-in page. Users of GitLab Enterprise Edition should use the [branded login
page feature](/ee/customization/branded_login_page.html) instead. page feature](/ee/customization/branded_login_page.html) instead.
## Omnibus-gitlab example The welcome message (extra_sign_in_text) can now be set/changed in the Admin UI.
Admin area > Settings
In `/etc/gitlab/gitlab.rb`: \ No newline at end of file
```ruby
gitlab_rails['extra_sign_in_text'] = <<'EOS'
# ACME GitLab
Welcome to the [ACME](http://www.example.com) GitLab server!
EOS
```
Run `sudo gitlab-ctl reconfigure` for changes to take effect.
## Installation from source
In `/home/git/gitlab/config/gitlab.yml`:
```yaml
# snip
production:
# snip
extra:
sign_in_text: |
# ACME GitLab
Welcome to the [ACME](http://www.example.com) GitLab server!
```
Run `sudo service gitlab reload` for the change to take effect.
...@@ -23,9 +23,11 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ...@@ -23,9 +23,11 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
cd /home/git/gitlab cd /home/git/gitlab
sudo -u git -H git fetch --all sudo -u git -H git fetch --all
sudo -u git -H git checkout -- Gemfile.lock db/schema.rb sudo -u git -H git checkout -- Gemfile.lock db/schema.rb
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) sudo -u git -H git checkout LATEST_TAG -b LATEST_TAG
sudo -u git -H git checkout $LATEST_TAG -b $LATEST_TAG
``` ```
Replace `LATEST_TAG` with the latest GitLab tag you want to update to, for example `v8.0.3`.
Use `git tag -l 'v*.[0-9]' --sort='v:refname'` to see a list of all tags.
Make sure to update patch versions only (check your current version with `cat VERSION`)
### 3. Update gitlab-shell to the corresponding version ### 3. Update gitlab-shell to the corresponding version
......
...@@ -35,7 +35,7 @@ module Gitlab ...@@ -35,7 +35,7 @@ module Gitlab
end end
def find_by_email def find_by_email
::User.find_by(email: auth_hash.email) ::User.find_by(email: auth_hash.email.downcase)
end end
def update_user_attributes def update_user_attributes
......
...@@ -13,6 +13,17 @@ describe Gitlab::LDAP::User do ...@@ -13,6 +13,17 @@ describe Gitlab::LDAP::User do
let(:auth_hash) do let(:auth_hash) do
OmniAuth::AuthHash.new(uid: 'my-uid', provider: 'ldapmain', info: info) OmniAuth::AuthHash.new(uid: 'my-uid', provider: 'ldapmain', info: info)
end end
let(:ldap_user_upper_case) { Gitlab::LDAP::User.new(auth_hash_upper_case) }
let(:info_upper_case) do
{
name: 'John',
email: 'John@Example.com', # Email address has upper case chars
nickname: 'john'
}
end
let(:auth_hash_upper_case) do
OmniAuth::AuthHash.new(uid: 'my-uid', provider: 'ldapmain', info: info_upper_case)
end
describe :changed? do describe :changed? do
it "marks existing ldap user as changed" do it "marks existing ldap user as changed" do
...@@ -57,6 +68,16 @@ describe Gitlab::LDAP::User do ...@@ -57,6 +68,16 @@ describe Gitlab::LDAP::User do
expect(existing_user.id).to eql ldap_user.gl_user.id expect(existing_user.id).to eql ldap_user.gl_user.id
end end
it 'connects to existing ldap user if the extern_uid changes and email address has upper case characters' do
existing_user = create(:omniauth_user, email: 'john@example.com', extern_uid: 'old-uid', provider: 'ldapmain')
expect{ ldap_user_upper_case.save }.not_to change{ User.count }
existing_user.reload
expect(existing_user.ldap_identity.extern_uid).to eql 'my-uid'
expect(existing_user.ldap_identity.provider).to eql 'ldapmain'
expect(existing_user.id).to eql ldap_user.gl_user.id
end
it 'maintains an identity per provider' do it 'maintains an identity per provider' do
existing_user = create(:omniauth_user, email: 'john@example.com', provider: 'twitter') existing_user = create(:omniauth_user, email: 'john@example.com', provider: 'twitter')
expect(existing_user.identities.count).to eql(1) expect(existing_user.identities.count).to eql(1)
......
# == Schema Information
#
# Table name: services
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# project_id :integer
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
# properties :text
# template :boolean default(FALSE)
# push_events :boolean default(TRUE)
# issues_events :boolean default(TRUE)
# merge_requests_events :boolean default(TRUE)
# tag_push_events :boolean default(TRUE)
# note_events :boolean default(TRUE), not null
#
require 'spec_helper'
describe BambooService, models: true do
describe "Associations" do
it { is_expected.to belong_to :project }
it { is_expected.to have_one :service_hook }
end
describe "Execute" do
let(:user) { create(:user) }
let(:project) { create(:project) }
before do
@bamboo_service = BambooService.create(
project: create(:project),
properties: {
bamboo_url: 'http://gitlab.com',
username: 'mic',
password: "password"
}
)
end
it "reset password if url changed" do
@bamboo_service.bamboo_url = 'http://gitlab1.com'
@bamboo_service.save
expect(@bamboo_service.password).to be_nil
end
it "does not reset password if username changed" do
@bamboo_service.username = "some_name"
@bamboo_service.save
expect(@bamboo_service.password).to eq("password")
end
end
end
# == Schema Information
#
# Table name: services
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# project_id :integer
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
# properties :text
# template :boolean default(FALSE)
# push_events :boolean default(TRUE)
# issues_events :boolean default(TRUE)
# merge_requests_events :boolean default(TRUE)
# tag_push_events :boolean default(TRUE)
# note_events :boolean default(TRUE), not null
#
require 'spec_helper'
describe TeamcityService, models: true do
describe "Associations" do
it { is_expected.to belong_to :project }
it { is_expected.to have_one :service_hook }
end
describe "Execute" do
let(:user) { create(:user) }
let(:project) { create(:project) }
before do
@teamcity_service = TeamcityService.create(
project: create(:project),
properties: {
teamcity_url: 'http://gitlab.com',
username: 'mic',
password: "password"
}
)
end
it "reset password if url changed" do
@teamcity_service.teamcity_url = 'http://gitlab1.com'
@teamcity_service.save
expect(@teamcity_service.password).to be_nil
end
it "does not reset password if username changed" do
@teamcity_service.username = "some_name"
@teamcity_service.save
expect(@teamcity_service.password).to eq("password")
end
end
end
...@@ -103,4 +103,27 @@ describe Service do ...@@ -103,4 +103,27 @@ describe Service do
end end
end end
end end
describe "#prop_updated?" do
let(:service) do
BambooService.create(
project: create(:project),
properties: {
bamboo_url: 'http://gitlab.com',
username: 'mic',
password: "password"
}
)
end
it "returns false" do
service.username = "key_changed"
expect(service.prop_updated?(:bamboo_url)).to be_falsy
end
it "returns true" do
service.bamboo_url = "http://other.com"
expect(service.prop_updated?(:bamboo_url)).to be_truthy
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment