Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-09-07 03:11:39 +00:00
parent ff97077fc8
commit 86db9fdda7
12 changed files with 36 additions and 92 deletions

View File

@ -25,7 +25,6 @@ module Ci
items = by_status(items)
items = by_ref(items)
items = by_sha(items)
items = by_name(items)
items = by_username(items)
items = by_yaml_errors(items)
items = by_updated_at(items)
@ -115,17 +114,6 @@ module Ci
end
# rubocop: enable CodeReuse/ActiveRecord
# This method is deprecated and will be removed in 14.3
# rubocop: disable CodeReuse/ActiveRecord
def by_name(items)
if params[:name].present?
items.joins(:user).where(users: { name: params[:name] })
else
items
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def by_username(items)
return items unless params[:username].present?

View File

@ -10,7 +10,7 @@ class ZoomMeeting < ApplicationRecord
validates :project, presence: true, unless: :importing?
validates :issue, presence: true, unless: :importing?
validates :url, presence: true, length: { maximum: 255 }, 'gitlab/utils/zoom_url': true
validates :url, presence: true, length: { maximum: 255 }, 'gitlab/zoom_url': true
validates :issue, same_project_association: true, unless: :importing?
enum issue_status: {

View File

@ -1,22 +0,0 @@
# frozen_string_literal: true
# Gitlab::Utils::ZoomUrlValidator
#
# Custom validator for zoom urls
#
module Gitlab
module Utils
class ZoomUrlValidator < ActiveModel::EachValidator
ALLOWED_SCHEMES = %w(https).freeze
def validate_each(record, attribute, value)
links_count = Gitlab::ZoomLinkExtractor.new(value).links.size
valid = Gitlab::UrlSanitizer.valid?(value, allowed_schemes: ALLOWED_SCHEMES)
return if links_count == 1 && valid
record.errors.add(:url, 'must contain one valid Zoom URL')
end
end
end
end

View File

@ -0,0 +1,22 @@
# frozen_string_literal: true
module Gitlab
# Gitlab::Utils::ZoomUrlValidator
#
# Custom validator for zoom urls
#
# @example usage
# validates :url, 'gitlab/zoom_url': true
class ZoomUrlValidator < ActiveModel::EachValidator
ALLOWED_SCHEMES = %w(https).freeze
def validate_each(record, attribute, value)
links_count = Gitlab::ZoomLinkExtractor.new(value).links.size
valid = Gitlab::UrlSanitizer.valid?(value, allowed_schemes: ALLOWED_SCHEMES)
return if links_count == 1 && valid
record.errors.add(:url, 'must contain one valid Zoom URL')
end
end
end

View File

@ -36,7 +36,6 @@ GET /projects/:id/pipelines
| `ref` | string | no | The ref of pipelines |
| `sha` | string | no | The SHA of pipelines |
| `yaml_errors`| boolean | no | Returns pipelines with invalid configurations |
| `name`| string | no | _([Deprecated in GitLab 14.2](https://gitlab.com/gitlab-org/gitlab/-/issues/336953))_ The name of the user who triggered pipelines |
| `username`| string | no | The username of the user who triggered pipelines |
| `updated_after` | datetime | no | Return pipelines updated after the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). |
| `updated_before` | datetime | no | Return pipelines updated before the specified date. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). |

View File

@ -4,7 +4,7 @@ group: Access
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Users API
# Users API **(FREE)**
## List users
@ -189,7 +189,7 @@ GET /users
]
```
Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see the `shared_runners_minutes_limit`, `extra_shared_runners_minutes_limit`, `is_auditor`, and `using_license_seat` parameters.
Users on [GitLab Premium or higher](https://about.gitlab.com/pricing/) also see the `shared_runners_minutes_limit`, `extra_shared_runners_minutes_limit`, `is_auditor`, and `using_license_seat` parameters.
```json
[
@ -205,7 +205,7 @@ Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see
]
```
Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see
Users on [GitLab Premium or higher](https://about.gitlab.com/pricing/) also see
the `group_saml` provider option and `provisioned_by_group_id` parameter:
```json
@ -357,7 +357,7 @@ Example Responses:
NOTE:
The `plan` and `trial` parameters are only available on GitLab Enterprise Edition.
Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see
Users on [GitLab Premium or higher](https://about.gitlab.com/pricing/) also see
the `shared_runners_minutes_limit`, `is_auditor`, and `extra_shared_runners_minutes_limit` parameters.
```json
@ -371,7 +371,7 @@ the `shared_runners_minutes_limit`, `is_auditor`, and `extra_shared_runners_minu
}
```
Users on GitLab.com [Premium or higher](https://about.gitlab.com/pricing/) also
Users on [GitLab.com Premium or higher](https://about.gitlab.com/pricing/) also
see the `group_saml` option and `provisioned_by_group_id` parameter:
```json
@ -627,7 +627,7 @@ GET /user
}
```
Users on GitLab [Premium or higher](https://about.gitlab.com/pricing/) also see these
Users on [GitLab Premium or higher](https://about.gitlab.com/pricing/) also see these
parameters:
- `shared_runners_minutes_limit`

View File

@ -29,6 +29,9 @@ For examples of how you can use a personal access token to authenticate with the
Alternately, GitLab administrators can use the API to create [impersonation tokens](../../api/index.md#impersonation-tokens).
Use impersonation tokens to automate authentication as a specific user.
NOTE:
Use your GitLab username and personal access tokens to authenticate with [GitLab managed Terraform state backend](../infrastructure/iac/terraform_state.md#using-a-gitlab-managed-terraform-state-backend-as-a-remote-data-source), [Docker container registry](../packages/container_registry/index.md#authenticate-with-the-container-registry), or when authenticating to a Git remote repository. Currently, GitLab usernames are ignored when authenticating with a personal access token, however, usernames may become a requirement in the future as per [issue #212953](https://gitlab.com/gitlab-org/gitlab/-/issues/212953).
## Create a personal access token
You can create as many personal access tokens as you like.

View File

@ -44,7 +44,6 @@ module API
optional :ref, type: String, desc: 'The ref of pipelines'
optional :sha, type: String, desc: 'The sha of pipelines'
optional :yaml_errors, type: Boolean, desc: 'Returns pipelines with invalid configurations'
optional :name, type: String, desc: '(deprecated) The name of the user who triggered pipelines'
optional :username, type: String, desc: 'The username of the user who triggered pipelines'
optional :updated_before, type: DateTime, desc: 'Return pipelines updated before the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ'
optional :updated_after, type: DateTime, desc: 'Return pipelines updated after the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ'

View File

@ -15340,7 +15340,7 @@ msgstr ""
msgid "GitLab is open source software to collaborate on code."
msgstr ""
msgid "GitLab is undergoing maintenance and is operating in a read-only mode."
msgid "GitLab is undergoing maintenance and is operating in read-only mode."
msgstr ""
msgid "GitLab member or Email address"
@ -22858,7 +22858,7 @@ msgstr ""
msgid "Nodes"
msgstr ""
msgid "Non-admin users can sign in with read-only access and make read-only API requests."
msgid "Non-admin users are restricted to read-only access, in both GitLab UI and API."
msgstr ""
msgid "None"
@ -25370,7 +25370,7 @@ msgstr ""
msgid "Prevent users from changing their profile name"
msgstr ""
msgid "Prevent users from performing write operations on GitLab while performing maintenance."
msgid "Prevent users from performing write operations while GitLab maintenance is in progress."
msgstr ""
msgid "Preview"

View File

@ -113,27 +113,6 @@ RSpec.describe Ci::PipelinesFinder do
end
end
context 'when name is specified' do
let(:user) { create(:user) }
let!(:pipeline) { create(:ci_pipeline, project: project, user: user) }
context 'when name exists' do
let(:params) { { name: user.name } }
it 'returns matched pipelines' do
is_expected.to eq([pipeline])
end
end
context 'when name does not exist' do
let(:params) { { name: 'invalid-name' } }
it 'returns empty' do
is_expected.to be_empty
end
end
end
context 'when username is specified' do
let(:user) { create(:user) }
let!(:pipeline) { create(:ci_pipeline, project: project, user: user) }

View File

@ -168,30 +168,6 @@ RSpec.describe API::Ci::Pipelines do
end
end
context 'when name is specified' do
let_it_be(:pipeline) { create(:ci_pipeline, project: project, user: user) }
context 'when name exists' do
it 'returns matched pipelines' do
get api("/projects/#{project.id}/pipelines", user), params: { name: user.name }
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response.first['id']).to eq(pipeline.id)
end
end
context 'when name does not exist' do
it 'returns empty' do
get api("/projects/#{project.id}/pipelines", user), params: { name: 'invalid-name' }
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response).to be_empty
end
end
end
context 'when username is specified' do
let_it_be(:pipeline) { create(:ci_pipeline, project: project, user: user) }

View File

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Utils::ZoomUrlValidator do
RSpec.describe Gitlab::ZoomUrlValidator do
let(:zoom_meeting) { build(:zoom_meeting) }
describe 'validations' do