diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-14 15:09:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-14 15:09:03 +0300 |
commit | 5366964a10484c2783a646b35a6da9eece01b242 (patch) | |
tree | 4a5a7a289d44e63d96a50a6a64db6e16b871f19c /lib | |
parent | 733befe96ad19f5a02e442c4a9cc8059d3aabbda (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/users.rb | 21 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/needs.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/import_export/group_import_export.yml | 7 | ||||
-rw-r--r-- | lib/gitlab_danger.rb | 1 |
4 files changed, 32 insertions, 3 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb index 4892a1fdd5b..c6dc7c08b11 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -225,6 +225,27 @@ module API end # rubocop: enable CodeReuse/ActiveRecord + desc "Delete a user's identity. Available only for admins" do + success Entities::UserWithAdmin + end + params do + requires :id, type: Integer, desc: 'The ID of the user' + requires :provider, type: String, desc: 'The external provider' + end + # rubocop: disable CodeReuse/ActiveRecord + delete ":id/identities/:provider" do + authenticated_as_admin! + + user = User.find_by(id: params[:id]) + not_found!('User') unless user + + identity = user.identities.find_by(provider: params[:provider]) + not_found!('Identity') unless identity + + destroy_conditionally!(identity) + end + # rubocop: enable CodeReuse/ActiveRecord + desc 'Add an SSH key to a specified user. Available only for admins.' do success Entities::SSHKey end diff --git a/lib/gitlab/ci/config/entry/needs.rb b/lib/gitlab/ci/config/entry/needs.rb index 5301c453ed4..d7ba8624882 100644 --- a/lib/gitlab/ci/config/entry/needs.rb +++ b/lib/gitlab/ci/config/entry/needs.rb @@ -11,12 +11,14 @@ module Gitlab include ::Gitlab::Config::Entry::Validatable validations do - validates :config, presence: true - validate do unless config.is_a?(Hash) || config.is_a?(Array) errors.add(:config, 'can only be a Hash or an Array') end + + if config.is_a?(Hash) && config.empty? + errors.add(:config, 'can not be an empty Hash') + end end validate on: :composed do diff --git a/lib/gitlab/import_export/group_import_export.yml b/lib/gitlab/import_export/group_import_export.yml index d7fbbbe0422..7dcfbed8968 100644 --- a/lib/gitlab/import_export/group_import_export.yml +++ b/lib/gitlab/import_export/group_import_export.yml @@ -28,8 +28,15 @@ included_attributes: excluded_attributes: group: - :id + - :name + - :path + - :owner_id + - :parent_id + - :created_at + - :updated_at - :runners_token - :runners_token_encrypted + - :saml_discovery_token methods: labels: diff --git a/lib/gitlab_danger.rb b/lib/gitlab_danger.rb index 499ae6111d7..e776e2b7ea3 100644 --- a/lib/gitlab_danger.rb +++ b/lib/gitlab_danger.rb @@ -18,7 +18,6 @@ class GitlabDanger changelog specs roulette - single_codebase gitlab_ui_wg ce_ee_vue_templates ].freeze |