Commit ee59acdd authored by Valery Sizov's avatar Valery Sizov

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

parents 1bf2cfbb 6b522faa
...@@ -755,19 +755,19 @@ Lint/BlockAlignment: ...@@ -755,19 +755,19 @@ Lint/BlockAlignment:
# Default values in optional keyword arguments and optional ordinal arguments # Default values in optional keyword arguments and optional ordinal arguments
# should not refer back to the name of the argument. # should not refer back to the name of the argument.
Lint/CircularArgumentReference: Lint/CircularArgumentReference:
Enabled: false Enabled: true
# Checks for condition placed in a confusing position relative to the keyword. # Checks for condition placed in a confusing position relative to the keyword.
Lint/ConditionPosition: Lint/ConditionPosition:
Enabled: false Enabled: true
# Check for debugger calls. # Check for debugger calls.
Lint/Debugger: Lint/Debugger:
Enabled: false Enabled: true
# Align ends corresponding to defs correctly. # Align ends corresponding to defs correctly.
Lint/DefEndAlignment: Lint/DefEndAlignment:
Enabled: false Enabled: true
# Check for deprecated class method calls. # Check for deprecated class method calls.
Lint/DeprecatedClassMethods: Lint/DeprecatedClassMethods:
...@@ -783,15 +783,15 @@ Lint/DuplicatedKey: ...@@ -783,15 +783,15 @@ Lint/DuplicatedKey:
# Check for immutable argument given to each_with_object. # Check for immutable argument given to each_with_object.
Lint/EachWithObjectArgument: Lint/EachWithObjectArgument:
Enabled: false Enabled: true
# Check for odd code arrangement in an else block. # Check for odd code arrangement in an else block.
Lint/ElseLayout: Lint/ElseLayout:
Enabled: false Enabled: true
# Checks for empty ensure block. # Checks for empty ensure block.
Lint/EmptyEnsure: Lint/EmptyEnsure:
Enabled: false Enabled: true
# Checks for empty string interpolation. # Checks for empty string interpolation.
Lint/EmptyInterpolation: Lint/EmptyInterpolation:
...@@ -799,37 +799,36 @@ Lint/EmptyInterpolation: ...@@ -799,37 +799,36 @@ Lint/EmptyInterpolation:
# Align ends correctly. # Align ends correctly.
Lint/EndAlignment: Lint/EndAlignment:
Enabled: false Enabled: true
# END blocks should not be placed inside method definitions. # END blocks should not be placed inside method definitions.
Lint/EndInMethod: Lint/EndInMethod:
Enabled: false Enabled: true
# Do not use return in an ensure block. # Do not use return in an ensure block.
Lint/EnsureReturn: Lint/EnsureReturn:
Enabled: false Enabled: true
# The use of eval represents a serious security risk. # The use of eval represents a serious security risk.
Lint/Eval: Lint/Eval:
Enabled: false Enabled: true
# Catches floating-point literals too large or small for Ruby to represent. # Catches floating-point literals too large or small for Ruby to represent.
Lint/FloatOutOfRange: Lint/FloatOutOfRange:
Enabled: false Enabled: true
# The number of parameters to format/sprint must match the fields. # The number of parameters to format/sprint must match the fields.
Lint/FormatParameterMismatch: Lint/FormatParameterMismatch:
Enabled: false Enabled: true
# Don't suppress exception. # Don't suppress exception.
Lint/HandleExceptions: Lint/HandleExceptions:
Enabled: false Enabled: false
# TODO: Enable ImplicitStringConcatenation Cop.
# Checks for adjacent string literals on the same line, which could better be # Checks for adjacent string literals on the same line, which could better be
# represented as a single string literal. # represented as a single string literal.
Lint/ImplicitStringConcatenation: Lint/ImplicitStringConcatenation:
Enabled: false Enabled: true
# TODO: Enable IneffectiveAccessModifier Cop. # TODO: Enable IneffectiveAccessModifier Cop.
# Checks for attempts to use `private` or `protected` to set the visibility # Checks for attempts to use `private` or `protected` to set the visibility
...@@ -840,7 +839,7 @@ Lint/IneffectiveAccessModifier: ...@@ -840,7 +839,7 @@ Lint/IneffectiveAccessModifier:
# Checks for invalid character literals with a non-escaped whitespace # Checks for invalid character literals with a non-escaped whitespace
# character. # character.
Lint/InvalidCharacterLiteral: Lint/InvalidCharacterLiteral:
Enabled: false Enabled: true
# Checks of literals used in conditions. # Checks of literals used in conditions.
Lint/LiteralInCondition: Lint/LiteralInCondition:
...@@ -848,7 +847,7 @@ Lint/LiteralInCondition: ...@@ -848,7 +847,7 @@ Lint/LiteralInCondition:
# Checks for literals used in interpolation. # Checks for literals used in interpolation.
Lint/LiteralInInterpolation: Lint/LiteralInInterpolation:
Enabled: false Enabled: true
# Use Kernel#loop with break rather than begin/end/until or begin/end/while # Use Kernel#loop with break rather than begin/end/until or begin/end/while
# for post-loop tests. # for post-loop tests.
...@@ -857,11 +856,11 @@ Lint/Loop: ...@@ -857,11 +856,11 @@ Lint/Loop:
# Do not use nested method definitions. # Do not use nested method definitions.
Lint/NestedMethodDefinition: Lint/NestedMethodDefinition:
Enabled: false Enabled: true
# Do not omit the accumulator when calling `next` in a `reduce`/`inject` block. # Do not omit the accumulator when calling `next` in a `reduce`/`inject` block.
Lint/NextWithoutAccumulator: Lint/NextWithoutAccumulator:
Enabled: false Enabled: true
# Checks for method calls with a space before the opening parenthesis. # Checks for method calls with a space before the opening parenthesis.
Lint/ParenthesesAsGroupedExpression: Lint/ParenthesesAsGroupedExpression:
...@@ -870,11 +869,11 @@ Lint/ParenthesesAsGroupedExpression: ...@@ -870,11 +869,11 @@ Lint/ParenthesesAsGroupedExpression:
# Checks for `rand(1)` calls. Such calls always return `0` and most likely # Checks for `rand(1)` calls. Such calls always return `0` and most likely
# a mistake. # a mistake.
Lint/RandOne: Lint/RandOne:
Enabled: false Enabled: true
# Use parentheses in the method call to avoid confusion about precedence. # Use parentheses in the method call to avoid confusion about precedence.
Lint/RequireParentheses: Lint/RequireParentheses:
Enabled: false Enabled: true
# Avoid rescuing the Exception class. # Avoid rescuing the Exception class.
Lint/RescueException: Lint/RescueException:
...@@ -909,7 +908,7 @@ Lint/UnusedMethodArgument: ...@@ -909,7 +908,7 @@ Lint/UnusedMethodArgument:
# Unreachable code. # Unreachable code.
Lint/UnreachableCode: Lint/UnreachableCode:
Enabled: false Enabled: true
# Checks for useless access modifiers. # Checks for useless access modifiers.
Lint/UselessAccessModifier: Lint/UselessAccessModifier:
...@@ -921,19 +920,19 @@ Lint/UselessAssignment: ...@@ -921,19 +920,19 @@ Lint/UselessAssignment:
# Checks for comparison of something with itself. # Checks for comparison of something with itself.
Lint/UselessComparison: Lint/UselessComparison:
Enabled: false Enabled: true
# Checks for useless `else` in `begin..end` without `rescue`. # Checks for useless `else` in `begin..end` without `rescue`.
Lint/UselessElseWithoutRescue: Lint/UselessElseWithoutRescue:
Enabled: false Enabled: true
# Checks for useless setter call to a local variable. # Checks for useless setter call to a local variable.
Lint/UselessSetterCall: Lint/UselessSetterCall:
Enabled: false Enabled: true
# Possible use of operator/literal/variable in void context. # Possible use of operator/literal/variable in void context.
Lint/Void: Lint/Void:
Enabled: false Enabled: true
##################### Performance ############################ ##################### Performance ############################
...@@ -942,11 +941,10 @@ Lint/Void: ...@@ -942,11 +941,10 @@ Lint/Void:
Performance/Casecmp: Performance/Casecmp:
Enabled: true Enabled: true
# TODO: Enable DoubleStartEndWith Cop.
# Use `str.{start,end}_with?(x, ..., y, ...)` instead of # Use `str.{start,end}_with?(x, ..., y, ...)` instead of
# `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`. # `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
Performance/DoubleStartEndWith: Performance/DoubleStartEndWith:
Enabled: false Enabled: true
# TODO: Enable EndWith Cop. # TODO: Enable EndWith Cop.
# Use `end_with?` instead of a regex match anchored to the end of a string. # Use `end_with?` instead of a regex match anchored to the end of a string.
...@@ -980,10 +978,9 @@ Performance/RedundantMerge: ...@@ -980,10 +978,9 @@ Performance/RedundantMerge:
MaxKeyValuePairs: 2 MaxKeyValuePairs: 2
Enabled: false Enabled: false
# TODO: Enable RedundantSortBy Cop.
# Use `sort` instead of `sort_by { |x| x }`. # Use `sort` instead of `sort_by { |x| x }`.
Performance/RedundantSortBy: Performance/RedundantSortBy:
Enabled: false Enabled: true
# TODO: Enable StartWith Cop. # TODO: Enable StartWith Cop.
# Use `start_with?` instead of a regex match anchored to the beginning of a # Use `start_with?` instead of a regex match anchored to the beginning of a
...@@ -1025,11 +1022,11 @@ Rails/Delegate: ...@@ -1025,11 +1022,11 @@ Rails/Delegate:
# Prefer `find_by` over `where.first`. # Prefer `find_by` over `where.first`.
Rails/FindBy: Rails/FindBy:
Enabled: false Enabled: true
# Prefer `all.find_each` over `all.find`. # Prefer `all.find_each` over `all.find`.
Rails/FindEach: Rails/FindEach:
Enabled: false Enabled: true
# Prefer has_many :through to has_and_belongs_to_many. # Prefer has_many :through to has_and_belongs_to_many.
Rails/HasAndBelongsToMany: Rails/HasAndBelongsToMany:
...@@ -1041,7 +1038,7 @@ Rails/Output: ...@@ -1041,7 +1038,7 @@ Rails/Output:
# Checks for incorrect grammar when using methods like `3.day.ago`. # Checks for incorrect grammar when using methods like `3.day.ago`.
Rails/PluralizationGrammar: Rails/PluralizationGrammar:
Enabled: false Enabled: true
# Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`. # Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
Rails/ReadWriteAttribute: Rails/ReadWriteAttribute:
...@@ -1049,7 +1046,7 @@ Rails/ReadWriteAttribute: ...@@ -1049,7 +1046,7 @@ Rails/ReadWriteAttribute:
# Checks the arguments of ActiveRecord scopes. # Checks the arguments of ActiveRecord scopes.
Rails/ScopeArgs: Rails/ScopeArgs:
Enabled: false Enabled: true
# Checks the correct usage of time zone aware methods. # Checks the correct usage of time zone aware methods.
# http://danilenko.org/2012/7/6/rails_timezones # http://danilenko.org/2012/7/6/rails_timezones
......
...@@ -14,11 +14,16 @@ v 8.8.0 ...@@ -14,11 +14,16 @@ v 8.8.0
- [Elastic] Improve code search - [Elastic] Improve code search
- [Elastic] Fix encoding issues during indexing - [Elastic] Fix encoding issues during indexing
- Warn admin if current active count exceeds license - Warn admin if current active count exceeds license
- [Elastic] Search through the filenames
- Set KRB5 as default clone protocol when Kerberos is enabled and user is logged in (Borja Aparicio) - Set KRB5 as default clone protocol when Kerberos is enabled and user is logged in (Borja Aparicio)
- Add support for Admin Groups to SAML
- Reduce emails-on-push HTML size by using a simple monospace font - Reduce emails-on-push HTML size by using a simple monospace font
- API requests to /internal/authorized_keys are now tagged properly - API requests to /internal/authorized_keys are now tagged properly
- Geo: Single Sign Out support !380 - Geo: Single Sign Out support !380
v 8.7.6
- Bump GitLab Pages to 0.2.4 to fix Content-Type for predefined 404
v 8.7.5 v 8.7.5
- No EE-specific changes - No EE-specific changes
......
...@@ -102,7 +102,7 @@ gem "seed-fu", '~> 2.3.5' ...@@ -102,7 +102,7 @@ gem "seed-fu", '~> 2.3.5'
# Search # Search
gem 'elasticsearch-model' gem 'elasticsearch-model'
gem 'elasticsearch-rails' gem 'elasticsearch-rails'
gem 'gitlab-elasticsearch-git', '~> 0.0.14', require: "elasticsearch/git" gem 'gitlab-elasticsearch-git', '~> 0.0.15', require: "elasticsearch/git"
# Markdown and HTML processing # Markdown and HTML processing
gem 'html-pipeline', '~> 1.11.0' gem 'html-pipeline', '~> 1.11.0'
......
...@@ -352,7 +352,7 @@ GEM ...@@ -352,7 +352,7 @@ GEM
mime-types (>= 1.19) mime-types (>= 1.19)
rugged (>= 0.24.0b13) rugged (>= 0.24.0b13)
github-markup (1.3.3) github-markup (1.3.3)
gitlab-elasticsearch-git (0.0.14) gitlab-elasticsearch-git (0.0.15)
activemodel (~> 4.2) activemodel (~> 4.2)
activesupport (~> 4.2) activesupport (~> 4.2)
charlock_holmes (~> 0.7) charlock_holmes (~> 0.7)
...@@ -965,7 +965,7 @@ DEPENDENCIES ...@@ -965,7 +965,7 @@ DEPENDENCIES
gemnasium-gitlab-service (~> 0.2) gemnasium-gitlab-service (~> 0.2)
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
github-markup (~> 1.3.1) github-markup (~> 1.3.1)
gitlab-elasticsearch-git (~> 0.0.14) gitlab-elasticsearch-git (~> 0.0.15)
gitlab-flowdock-git-hook (~> 1.0.1) gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-license (~> 0.0.4) gitlab-license (~> 0.0.4)
gitlab_emoji (~> 0.3.0) gitlab_emoji (~> 0.3.0)
......
...@@ -1000,11 +1000,13 @@ class Repository ...@@ -1000,11 +1000,13 @@ class Repository
content = result["_source"]["blob"]["content"] content = result["_source"]["blob"]["content"]
total_lines = content.lines.size total_lines = content.lines.size
term = result["highlight"]["blob.content"][0].match(/gitlabelasticsearch→(.*?)←gitlabelasticsearch/)[1] highlighted_content = result["highlight"]["blob.content"]
term = highlighted_content && highlighted_content[0].match(/gitlabelasticsearch→(.*?)←gitlabelasticsearch/)[1]
found_line_number = 0 found_line_number = 0
content.each_line.each_with_index do |line, index| content.each_line.each_with_index do |line, index|
if line.include?(term) if term && line.include?(term)
found_line_number = index found_line_number = index
break break
end end
......
.account-well.prepend-top-default.append-bottom-default
%ul
%li
The repository must be accessible over <code>http://</code>, <code>https://</code>, <code>ssh://</code> or <code>git://</code>.
%li
If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>.
%li
If your SSH repository is not publicly accessible, add the public SSH key of the GitLab server to the remote repository.
%li
The update action will time out after 10 minutes. For big repositories, use a clone/push combination.
- page_title "Mirror Repository" - page_title "Mirror Repository"
%h3.page-title
Mirror Repository
%p.light .row.prepend-top-default.append-bottom-default
A repository can be setup as a mirror of another repository, and can also have a remote mirror associated. .col-lg-3
%h4.prepend-top-0
%p.light Pull from a remote repository
When the repository is configured as a mirror, all of its branches, tags, and commits will automatically be updated from the repository configured in the %p.light
%strong Pull from a remote repository Set up your project to automatically have its branches, tags, and commits updated from an upstream repository every hour.
section. .col-lg-9
%h5.prepend-top-0
%p.light Set up mirror repository
When the repository has a remote mirror associated, it means that the remote repository configured in the <strong>Push to a remote repository</strong> section will automatically receive updates from the current repository. = form_for @project, url: namespace_project_mirror_path(@project.namespace, @project) do |f|
= form_errors(@project)
%hr.clearfix = render "shared/mirror_update_button"
- if @project.mirror_last_update_failed?
= form_for @project, url: namespace_project_mirror_path(@project.namespace, @project), html: { class: 'form-horizontal' } do |f| .panel.panel-danger
- if @project.errors.any? .panel-heading
.alert.alert-danger The repository failed to update #{time_ago_with_tooltip(@project.mirror_last_update_at)}.
- @project.errors.full_messages.each do |msg| - if @project.mirror_ever_updated_successfully?
%p= msg Last successful update #{time_ago_with_tooltip(@project.mirror_last_successful_update_at)}.
.panel-body
%h4 Pull from a remote repository %pre
%p.light :preserve
Set up your project to automatically have its branches, tags, and commits updated from an upstream repository every hour. #{@project.import_error.try(:strip)}
= render "shared/mirror_update_button" .form-group
- if @project.mirror_last_update_success? = f.check_box :mirror, class: "pull-left"
%span.prepend-left-default Successfully updated #{time_ago_with_tooltip(@project.mirror_last_successful_update_at)}. .prepend-left-20
%hr.clearfix = f.label :mirror, "Mirror repository", class: "label-light append-bottom-0"
%p.light.append-bottom-0
- if @project.mirror_last_update_failed? Automatically update this project's branches, tags, and commits from the upstream repository every hour.
.panel.panel-danger .form-group
.panel-heading = f.label :import_url, "Git repository URL", class: "label-light"
The repository failed to update #{time_ago_with_tooltip(@project.mirror_last_update_at)}. = f.text_field :import_url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git'
- if @project.mirror_ever_updated_successfully? = render "instructions"
Last successful update #{time_ago_with_tooltip(@project.mirror_last_successful_update_at)}. .form-group
.panel-body = f.label :mirror_user_id, "Mirror user", class: "label-light"
%pre = users_select_tag("project[mirror_user_id]", class: 'input-large', selected: @project.mirror_user_id || current_user.id,
:preserve first_user: true, current_user: true, push_code_to_protected_branches: true)
#{@project.import_error.try(:strip)}
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :mirror do
= f.check_box :mirror
%strong
Mirror repository
.help-block .help-block
Automatically update this project's branches, tags, and commits from the upstream repository every hour. This user will be the author of all events in the activity feed that are the result of an update,
like new branches being created or new commits being pushed to existing branches.
.form-group They need to have at least master access to this project.
= f.label :import_url, class: 'control-label' do - if @project.builds_enabled?
%span Git repository URL = render "shared/mirror_trigger_builds_setting", f: f
.col-sm-10 = f.submit "Update", class: "btn btn-save"
= f.text_field :import_url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git' .col-sm-12
.well.prepend-top-20 %hr
%ul .col-lg-3
%li %h4.prepend-top-0
The repository must be accessible over <code>http://</code>, <code>https://</code>, <code>ssh://</code> or <code>git://</code>. Push to a remote repository
%li %p.light
If your HTTP repository is not publicly accessible, add authentication information to the URL: <code>https://username:password@gitlab.company.com/group/project.git</code>. Set up the remote repository that you want to update with the content of the current repository every hour.
%li .col-lg-9
If your SSH repository is not publicly accessible, add the public SSH key of the GitLab server to the remote repository. = form_for @project, url: namespace_project_mirror_path(@project.namespace, @project) do |f|
%li = form_errors(@project)
The update action will time out after 10 minutes. For big repositories, use a clone/push combination. = render "shared/remote_mirror_update_button", remote_mirror: @remote_mirror
- if @remote_mirror.last_error.present?
.form-group .panel.panel-danger
= f.label :mirror_user_id, class: 'control-label' do .panel-heading
Mirror user The remote repository failed to update #{time_ago_with_tooltip(@remote_mirror.last_update_at)}.
.col-sm-10 - if @remote_mirror.last_successful_update_at
= users_select_tag("project[mirror_user_id]", class: 'input-large', selected: @project.mirror_user_id || current_user.id, Last successful update #{time_ago_with_tooltip(@remote_mirror.last_successful_update_at)}.
first_user: true, current_user: true, push_code_to_protected_branches: true) .panel-body
.help-block %pre
This user will be the author of all events in the activity feed that are the result of an update, :preserve
like new branches being created or new commits being pushed to existing branches. #{@remote_mirror.last_error.strip}
They need to have at least master access to this project. = f.fields_for :remote_mirrors, @remote_mirror do |rm_form|
.form-group
- if @project.builds_enabled? = rm_form.check_box :enabled, class: "pull-left"
= render 'shared/mirror_trigger_builds_setting', f: f .prepend-left-20
= rm_form.label :enabled, "Remote mirror repository", class: "label-light append-bottom-0"
%h4 Push to a remote repository %p.light.append-bottom-0
%p.light Automatically update the remote mirror's branches, tags, and commits from this repository every hour.
Set up the remote repository that you want to update with the content of the current repository every hour. .form-group.has-feedback
= render "shared/remote_mirror_update_button", remote_mirror: @remote_mirror = rm_form.label :url, "Git repository URL", class: "label-light"
- if @remote_mirror.last_successful_update_at = rm_form.text_field :url, class: "form-control", placeholder: 'https://username:password@gitlab.company.com/group/project.git'
%span.prepend-left-default Successfully updated #{time_ago_with_tooltip(@remote_mirror.last_successful_update_at)}. = render "instructions"
= f.submit "Update", class: "btn btn-create"
%hr.clearfix
- if @remote_mirror.last_error.present?
.panel.panel-danger
.panel-heading
The remote repository failed to update #{time_ago_with_tooltip(@remote_mirror.last_update_at)}.
- if @remote_mirror.last_successful_update_at
Last successful update #{time_ago_with_tooltip(@remote_mirror.last_successful_update_at)}.
.panel-body
%pre
:preserve
#{@remote_mirror.last_error.strip}
= f.fields_for :remote_mirrors, @remote_mirror do |rm_form|
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= rm_form.label :enabled do
= rm_form.check_box :enabled
%strong
Remote Mirror Repository
.help-block
Automatically update the remote mirror's branches, tags, and commits from this repository every hour.
.form-group.has-feedback
= rm_form.label :url, class: 'control-label' do
%span Git repository URL
.col-sm-10
= rm_form.text_field :url, class: 'form-control', placeholder: 'https://username:password@gitlab.company.com/group/project.git'
.well.prepend-top-20
The requirements for the URL format are the same mentioned in the <strong>Pull from a remote repository</strong> section.
.form-actions
= f.submit "Save Changes", class: "btn btn-create"
.form-group .form-group
.col-sm-offset-2.col-sm-10 = f.check_box :mirror_trigger_builds, class: "pull-left"
.checkbox .prepend-left-20
= f.label :mirror_trigger_builds do = f.label :mirror_trigger_builds, "Trigger builds for mirror updates", class: "label-light"
= f.check_box :mirror_trigger_builds %p.light.append-bottom-0
%strong Trigger builds when branches or tags are updated from the upstream repository.
Trigger builds for mirror updates Depending on the activity of the upstream repository, this may greatly increase the load on your CI runners.
.help-block Only enable this if you know they can handle the load.
Trigger builds when branches or tags are updated from the upstream repository.
Depending on the activity of the upstream repository, this may greatly increase the load on your CI runners.
Only enable this if you know they can handle the load.
- if @project.mirror? && can?(current_user, :push_code, @project) - if @project.mirror? && can?(current_user, :push_code, @project)
- if @project.updating_mirror? .append-bottom-default
%span.btn.disabled - if @project.updating_mirror?
= icon('refresh') %span.btn.disabled
Updating&hellip; = icon("refresh spin")
- else Updating&hellip;
= link_to update_now_namespace_project_mirror_path(@project.namespace, @project), method: :post, class: "btn" do - else
= icon('refresh') = link_to update_now_namespace_project_mirror_path(@project.namespace, @project), method: :post, class: "btn" do
Update Now = icon("refresh")
Update Now
- if @project.mirror_last_update_success?
%p.inline.prepend-left-10
Successfully updated #{time_ago_with_tooltip(@project.mirror_last_successful_update_at)}.
- if @project.has_remote_mirror? - if @project.has_remote_mirror?
- if remote_mirror.update_in_progress? .append-bottom-default
%span.btn.disabled - if remote_mirror.update_in_progress?
= icon('refresh') %span.btn.disabled
Updating&hellip; = icon("refresh spin")
- else Updating&hellip;
= link_to update_now_namespace_project_mirror_path(@project.namespace, @project, sync_remote: true), method: :post, class: "btn" do - else
= icon('refresh') = link_to update_now_namespace_project_mirror_path(@project.namespace, @project, sync_remote: true), method: :post, class: "btn" do
Update Now = icon("refresh")
Update Now
- if @remote_mirror.last_successful_update_at
%p.inline.prepend-left-10
Successfully updated #{time_ago_with_tooltip(@remote_mirror.last_successful_update_at)}.
...@@ -175,6 +175,30 @@ tell GitLab which groups are external via the `external_groups:` element: ...@@ -175,6 +175,30 @@ tell GitLab which groups are external via the `external_groups:` element:
} } } }
``` ```
## Admin Groups
>**Note:**
This setting is only available on GitLab 8.8 EE and above.
This setting works very similarly to the `External Groups` setting. The requirements
are the same, your IdP needs to pass Group information to GitLab, you need to tell
GitLab where to look for the groups in the SAML response, and which group should be
considered `admin groups`.
```yaml
{ name: 'saml',
label: 'Our SAML Provider',
groups_attribute: 'Groups',
admin_groups: ['Managers', 'Admins'],
args: {
assertion_consumer_service_url: 'https://gitlab.example.com/users/auth/saml/callback',
idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8',
idp_sso_target_url: 'https://login.example.com/idp',
issuer: 'https://gitlab.example.com',
name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
} }
```
## Customization ## Customization
### `auto_sign_in_with_provider` ### `auto_sign_in_with_provider`
......
...@@ -151,6 +151,16 @@ When index mapping is changed the whole index should be removed and built from t ...@@ -151,6 +151,16 @@ When index mapping is changed the whole index should be removed and built from t
bundle exec rake gitlab:elastic:delete_indexes bundle exec rake gitlab:elastic:delete_indexes
``` ```
1. Clear repository index status:
```
# Omnibus installations
sudo gitlab-rake gitlab:elastic:clear_index_status
# Installations from source
bundle exec rake gitlab:elastic:clear_index_status
```
1. Create new, empty indexes: 1. Create new, empty indexes:
``` ```
......
...@@ -24,7 +24,7 @@ module API ...@@ -24,7 +24,7 @@ module API
@users = @users.non_ldap if skip_ldap @users = @users.non_ldap if skip_ldap
@users = @users.search(params[:search]) if params[:search].present? @users = @users.search(params[:search]) if params[:search].present?
@users = paginate @users @users = paginate @users
end end
if current_user.is_admin? if current_user.is_admin?
present @users, with: Entities::UserFull present @users, with: Entities::UserFull
......
...@@ -14,6 +14,10 @@ module Gitlab ...@@ -14,6 +14,10 @@ module Gitlab
def external_groups def external_groups
options[:external_groups] options[:external_groups]
end end
def admin_groups
options[:admin_groups]
end
end end
end end
......
...@@ -36,6 +36,14 @@ module Gitlab ...@@ -36,6 +36,14 @@ module Gitlab
end end
end end
if admin_groups_enabled? && @user
if (auth_hash.groups & Gitlab::Saml::Config.admin_groups).empty?
@user.admin = false
else
@user.admin = true
end
end
@user @user
end end
...@@ -65,6 +73,10 @@ module Gitlab ...@@ -65,6 +73,10 @@ module Gitlab
def auth_hash=(auth_hash) def auth_hash=(auth_hash)
@auth_hash = Gitlab::Saml::AuthHash.new(auth_hash) @auth_hash = Gitlab::Saml::AuthHash.new(auth_hash)
end end
def admin_groups_enabled?
!Gitlab::Saml::Config.admin_groups.nil?
end
end end
end end
end end
...@@ -106,7 +106,7 @@ describe Oauth::GeoAuthController do ...@@ -106,7 +106,7 @@ describe Oauth::GeoAuthController do
allow_any_instance_of(Oauth2::LogoutTokenValidationService).to receive(:execute) { { status: :error, message: :expired } } allow_any_instance_of(Oauth2::LogoutTokenValidationService).to receive(:execute) { { status: :error, message: :expired } }
get :logout, state: logout_state get :logout, state: logout_state
expect(response.body).to include("There is a problem with the OAuth access_token: #{:expired}") expect(response.body).to include("There is a problem with the OAuth access_token: expired")
end end
end end
end end
......
...@@ -31,6 +31,10 @@ describe Gitlab::Saml::User, lib: true do ...@@ -31,6 +31,10 @@ describe Gitlab::Saml::User, lib: true do
allow(Gitlab::Saml::Config).to receive_messages({ options: { name: 'saml', groups_attribute: 'groups', external_groups: groups, args: {} } }) allow(Gitlab::Saml::Config).to receive_messages({ options: { name: 'saml', groups_attribute: 'groups', external_groups: groups, args: {} } })
end end
def stub_saml_admin_group_config(groups)
allow(Gitlab::Saml::Config).to receive_messages({ options: { name: 'saml', groups_attribute: 'groups', admin_groups: groups, args: {} } })
end
before { stub_basic_saml_config } before { stub_basic_saml_config }
describe 'account exists on server' do describe 'account exists on server' do
...@@ -75,6 +79,35 @@ describe Gitlab::Saml::User, lib: true do ...@@ -75,6 +79,35 @@ describe Gitlab::Saml::User, lib: true do
end end
end end
end end
context 'admin groups' do
context 'are defined' do
it 'marks the user as admin' do
stub_saml_admin_group_config(%w(Developers))
saml_user.save
expect(gl_user).to be_valid
expect(gl_user.admin).to be_truthy
end
end
before { stub_saml_admin_group_config(%w(Admins)) }
context 'are defined but the user does not belong there' do
it 'does not mark the user as admin' do
saml_user.save
expect(gl_user).to be_valid
expect(gl_user.admin).to be_falsey
end
end
context 'user was admin, now should not be' do
it 'should make user non admin' do
existing_user.update_attribute('admin', true)
saml_user.save
expect(gl_user).to be_valid
expect(gl_user.admin).to be_falsey
end
end
end
end end
describe 'no account exists on server' do describe 'no account exists on server' do
...@@ -127,6 +160,26 @@ describe Gitlab::Saml::User, lib: true do ...@@ -127,6 +160,26 @@ describe Gitlab::Saml::User, lib: true do
end end
end end
context 'admin groups' do
context 'are defined' do
it 'marks the user as admin' do
stub_saml_admin_group_config(%w(Developers))
saml_user.save
expect(gl_user).to be_valid
expect(gl_user.admin).to be_truthy
end
end
context 'are defined but the user does not belong there' do
it 'does not mark the user as admin' do
stub_saml_admin_group_config(%w(Admins))
saml_user.save
expect(gl_user).to be_valid
expect(gl_user.admin).to be_falsey
end
end
end
context 'with auto_link_ldap_user disabled (default)' do context 'with auto_link_ldap_user disabled (default)' do
before { stub_omniauth_config({ auto_link_ldap_user: false, auto_link_saml_user: false, allow_single_sign_on: ['saml'] }) } before { stub_omniauth_config({ auto_link_ldap_user: false, auto_link_saml_user: false, allow_single_sign_on: ['saml'] }) }
include_examples 'to verify compliance with allow_single_sign_on' include_examples 'to verify compliance with allow_single_sign_on'
......
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