Commit e89c0d20 authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-11-15

parents f525cb1f 6494467a
......@@ -11,6 +11,7 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController
@impersonation_token = finder.build(impersonation_token_params)
if @impersonation_token.save
PersonalAccessToken.redis_store!(current_user.id, @impersonation_token.token)
redirect_to admin_user_impersonation_tokens_path, notice: "A new impersonation token has been created."
else
set_index_vars
......@@ -53,6 +54,8 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController
@impersonation_token ||= finder.build
@inactive_impersonation_tokens = finder(state: 'inactive').execute
@active_impersonation_tokens = finder(state: 'active').execute.order(:expires_at)
@new_impersonation_token = PersonalAccessToken.redis_getdel(current_user.id)
end
# rubocop: enable CodeReuse/ActiveRecord
end
......@@ -5,6 +5,11 @@
.row.prepend-top-default
.col-lg-12
- if @new_impersonation_token
= render "shared/personal_access_tokens_created_container", new_token_value: @new_impersonation_token,
container_title: 'Your New Impersonation Token',
clipboard_button_title: 'Copy impersonation token to clipboard'
= render "shared/personal_access_tokens_form", path: admin_user_impersonation_tokens_path, impersonation: true, token: @impersonation_token, scopes: @scopes
= render "shared/personal_access_tokens_table", impersonation: true, active_tokens: @active_impersonation_tokens, inactive_tokens: @inactive_impersonation_tokens
......@@ -14,17 +14,7 @@
.col-lg-8
- if @new_personal_access_token
.created-personal-access-token-container
%h5.prepend-top-0
Your New Personal Access Token
.form-group
.input-group
= text_field_tag 'created-personal-access-token', @new_personal_access_token, readonly: true, class: "form-control js-select-on-focus", 'aria-describedby' => "created-personal-access-token-help-block"
%span.input-group-append
= clipboard_button(text: @new_personal_access_token, title: "Copy personal access token to clipboard", placement: "left", class: "input-group-text btn-default btn-clipboard")
%span#created-personal-access-token-help-block.form-text.text-muted.text-danger Make sure you save it - you won't be able to access it again.
%hr
= render "shared/personal_access_tokens_created_container", new_token_value: @new_personal_access_token
= render "shared/personal_access_tokens_form", path: profile_personal_access_tokens_path, impersonation: false, token: @personal_access_token, scopes: @scopes
......
- container_title = local_assigns.fetch(:container_title, 'Your New Personal Access Token')
- clipboard_button_title = local_assigns.fetch(:clipboard_button_title, 'Copy personal access token to clipboard')
.created-personal-access-token-container
%h5.prepend-top-0
= container_title
.form-group
.input-group
= text_field_tag 'created-personal-access-token', new_token_value, readonly: true, class: "form-control js-select-on-focus", 'aria-describedby' => "created-token-help-block"
%span.input-group-append
= clipboard_button(text: new_token_value, title: clipboard_button_title, placement: "left", class: "input-group-text btn-default btn-clipboard")
%span#created-token-help-block.form-text.text-muted.text-danger Make sure you save it - you won't be able to access it again.
%hr
......@@ -15,8 +15,6 @@
%th Created
%th Expires
%th Scopes
- if impersonation
%th Token
%th
%tbody
- active_tokens.each do |token|
......@@ -30,10 +28,6 @@
- else
%span.token-never-expires-label Never
%td= token.scopes.present? ? token.scopes.join(", ") : "<no scopes selected>"
- if impersonation
%td.token-token-container
= text_field_tag 'impersonation-token-token', token.token, readonly: true, class: "form-control"
= clipboard_button(text: token.token)
- path = impersonation ? revoke_admin_user_impersonation_token_path(token.user, token) : revoke_profile_personal_access_token_path(token)
%td= link_to "Revoke", path, method: :put, class: "btn btn-danger float-right", data: { confirm: "Are you sure you want to revoke this #{type} Token? This action cannot be undone." }
- else
......
---
title: Display impersonation token value only after creation
merge_request: 22916
author:
type: fixed
---
title: Enable even more frozen string in lib/gitlab/**/*.rb
merge_request:
author: gfyoung
type: performance
......@@ -1077,7 +1077,6 @@ Example response:
[
{
"active" : true,
"token" : "EsMo-vhKfXGwX9RKrwiy",
"scopes" : [
"api"
],
......@@ -1094,7 +1093,6 @@ Example response:
"read_user"
],
"revoked" : true,
"token" : "ZcZRpLeEuQRprkRjYydY",
"name" : "mytoken2",
"created_at" : "2017-03-17T17:19:28.697Z",
"id" : 3,
......@@ -1130,7 +1128,6 @@ Example response:
```json
{
"active" : true,
"token" : "EsMo-vhKfXGwX9RKrwiy",
"scopes" : [
"api"
],
......@@ -1147,6 +1144,8 @@ Example response:
> Requires admin permissions.
> Token values are returned once. Make sure you save it - you won't be able to access it again.
It creates a new impersonation token. Note that only administrators can do this.
You are only able to create impersonation tokens to impersonate the user and perform
both API calls and Git reads and writes. The user will not see these tokens in their profile
......
......@@ -1291,7 +1291,11 @@ module API
expose :token
end
class ImpersonationToken < PersonalAccessTokenWithToken
class ImpersonationToken < PersonalAccessToken
expose :impersonation
end
class ImpersonationTokenWithToken < PersonalAccessTokenWithToken
expose :impersonation
end
......
......@@ -537,7 +537,7 @@ module API
desc 'Create a impersonation token. Available only for admins.' do
detail 'This feature was introduced in GitLab 9.0'
success Entities::ImpersonationToken
success Entities::ImpersonationTokenWithToken
end
params do
requires :name, type: String, desc: 'The name of the impersonation token'
......@@ -548,7 +548,7 @@ module API
impersonation_token = finder.build(declared_params(include_missing: false))
if impersonation_token.save
present impersonation_token, with: Entities::ImpersonationToken
present impersonation_token, with: Entities::ImpersonationTokenWithToken
else
render_validation_error!(impersonation_token)
end
......
# frozen_string_literal: true
require 'fogbugz'
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module FogbugzImport
class Importer
......
# frozen_string_literal: true
module Gitlab
module FogbugzImport
class ProjectCreator
......
# frozen_string_literal: true
module Gitlab
module FogbugzImport
class Repository
......
# frozen_string_literal: true
module Gitlab
module Gfm
##
......
# frozen_string_literal: true
require 'fileutils'
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
# Parses root .gitattributes file at a given ref
......
# frozen_string_literal: true
module Gitlab
module Git
# Class for parsing Git attribute files and extracting the attributes for
......
# frozen_string_literal: true
module Gitlab
module Git
class Blame
......
# frozen_string_literal: true
# Gitaly note: JV: seems to be completely migrated (behind feature flags).
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
class Branch < Ref
......
# frozen_string_literal: true
# Gitlab::Git::Commit is a wrapper around Gitaly::GitCommit
module Gitlab
module Git
......
# frozen_string_literal: true
# Gitlab::Git::CommitStats counts the additions, deletions, and total changes
# in a commit.
module Gitlab
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
module Conflict
......
# frozen_string_literal: true
module Gitlab
module Git
module Conflict
......
# frozen_string_literal: true
module Gitlab
module Git
module Conflict
......
# frozen_string_literal: true
module Gitlab
module Git
module Conflict
......
# frozen_string_literal: true
module Gitlab
module Git
class Diff
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
class Index
......
# frozen_string_literal: true
module Gitlab
module Git
class LfsChanges
......
# frozen_string_literal: true
module Gitlab
module Git
class LfsPointerFile
......
# frozen_string_literal: true
module Gitlab
module Git
class OperationService
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
#
......
# frozen_string_literal: true
module Gitlab
module Git
# This class behaves like a struct with fields :blob_id, :blob_size, :operation, :old_path, :new_path
......
# frozen_string_literal: true
module Gitlab
module Git
class Ref
......
# frozen_string_literal: true
module Gitlab
module Git
class RemoteMirror
......
# frozen_string_literal: true
module Gitlab
module Git
#
......
# frozen_string_literal: true
require 'tempfile'
require 'forwardable'
require "rubygems/package"
......
# frozen_string_literal: true
module Gitlab
module Git
module RepositoryMirroring
......
# frozen_string_literal: true
module Gitlab
module Git
class Tag < Ref
......
# frozen_string_literal: true
module Gitlab
module Git
class Tree
......
# frozen_string_literal: true
module Gitlab
module Git
class User
......
# frozen_string_literal: true
# Gitaly note: JV: no RPC's here.
module Gitlab
......
# frozen_string_literal: true
module Gitlab
module Git
module Version
......
# frozen_string_literal: true
module Gitlab
module Git
class Wiki
......
# frozen_string_literal: true
module Gitlab
module Git
class WikiFile
......
# frozen_string_literal: true
module Gitlab
module Git
class WikiPage
......
# frozen_string_literal: true
module Gitlab
module Git
class WikiPageVersion
......
# frozen_string_literal: true
module Gitlab
module Git
module WrapsGitalyErrors
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
# This module expects an `ATTRS` const to be defined on the subclass
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class BlobService
......@@ -15,7 +17,7 @@ module Gitlab
)
response = GitalyClient.call(@gitaly_repo.storage_name, :blob_service, :get_blob, request, timeout: GitalyClient.fast_timeout)
data = ''
data = []
blob = nil
response.each do |msg|
if blob.nil?
......@@ -27,6 +29,8 @@ module Gitlab
return nil if blob.oid.blank?
data = data.join
Gitlab::Git::Blob.new(
id: blob.oid,
size: blob.size,
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class BlobsStitcher
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class CommitService
......@@ -93,7 +95,7 @@ module Gitlab
response = GitalyClient.call(@repository.storage, :commit_service, :tree_entry, request, timeout: GitalyClient.medium_timeout)
entry = nil
data = ''
data = []
response.each do |msg|
if entry.nil?
entry = msg
......@@ -103,7 +105,7 @@ module Gitlab
data << msg.data
end
entry.data = data
entry.data = data.join
entry unless entry.oid.blank?
end
......@@ -254,7 +256,7 @@ module Gitlab
)
response = GitalyClient.call(@repository.storage, :commit_service, :raw_blame, request, timeout: GitalyClient.medium_timeout)
response.reduce("") { |memo, msg| memo << msg.data }
response.reduce([]) { |memo, msg| memo << msg.data }.join
end
def find_commit(revision)
......@@ -345,8 +347,8 @@ module Gitlab
request = Gitaly::ExtractCommitSignatureRequest.new(repository: @gitaly_repo, commit_id: commit_id)
response = GitalyClient.call(@repository.storage, :commit_service, :extract_commit_signature, request)
signature = ''.b
signed_text = ''.b
signature = +''.b
signed_text = +''.b
response.each do |message|
signature << message.signature
......@@ -364,7 +366,7 @@ module Gitlab
request = Gitaly::GetCommitSignaturesRequest.new(repository: @gitaly_repo, commit_ids: commit_ids)
response = GitalyClient.call(@repository.storage, :commit_service, :get_commit_signatures, request, timeout: GitalyClient.fast_timeout)
signatures = Hash.new { |h, k| h[k] = [''.b, ''.b] }
signatures = Hash.new { |h, k| h[k] = [+''.b, +''.b] }
current_commit_id = nil
response.each do |message|
......@@ -383,7 +385,7 @@ module Gitlab
request = Gitaly::GetCommitMessagesRequest.new(repository: @gitaly_repo, commit_ids: commit_ids)
response = GitalyClient.call(@repository.storage, :commit_service, :get_commit_messages, request, timeout: GitalyClient.fast_timeout)
messages = Hash.new { |h, k| h[k] = ''.b }
messages = Hash.new { |h, k| h[k] = +''.b }
current_commit_id = nil
response.each do |rpc_message|
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class ConflictFilesStitcher
......@@ -17,7 +19,7 @@ module Gitlab
current_file = file_from_gitaly_header(gitaly_file.header)
else
current_file.raw_content << gitaly_file.content
current_file.raw_content = "#{current_file.raw_content}#{gitaly_file.content}"
end
end
end
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class ConflictsService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class Diff
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class DiffStitcher
......@@ -20,7 +22,7 @@ module Gitlab
current_diff = GitalyClient::Diff.new(diff_params)
else
current_diff.patch += diff_msg.raw_patch_data
current_diff.patch = "#{current_diff.patch}#{diff_msg.raw_patch_data}"
end
if diff_msg.end_of_patch
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class HealthCheckService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class NamespaceService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class NotificationService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class OperationService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class QueueEnumerator
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class RefService
......@@ -225,7 +227,7 @@ module Gitlab
request = Gitaly::GetTagMessagesRequest.new(repository: @gitaly_repo, tag_ids: tag_ids)
response = GitalyClient.call(@repository.storage, :ref_service, :get_tag_messages, request, timeout: GitalyClient.fast_timeout)
messages = Hash.new { |h, k| h[k] = ''.b }
messages = Hash.new { |h, k| h[k] = +''.b }
current_tag_id = nil
response.each do |rpc_message|
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class RemoteService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class RepositoryService
......@@ -56,9 +58,9 @@ module Gitlab
request = Gitaly::GetInfoAttributesRequest.new(repository: @gitaly_repo)
response = GitalyClient.call(@storage, :repository_service, :get_info_attributes, request, timeout: GitalyClient.fast_timeout)
response.each_with_object("") do |message, attributes|
response.each_with_object([]) do |message, attributes|
attributes << message.attributes
end
end.join
end
def fetch_remote(remote, ssh_auth:, forced:, no_tags:, timeout:, prune: true)
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
# Meant for extraction of server data, and later maybe to perform misc task
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class StorageService
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
# This is a chokepoint that is meant to help us stop remove all places
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
module Util
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class WikiFile
......
# frozen_string_literal: true
module Gitlab
module GitalyClient
class WikiPage
......
# frozen_string_literal: true
require 'stringio'
module Gitlab
......@@ -139,7 +141,7 @@ module Gitlab
next unless message.name.present? || wiki_file
if wiki_file
wiki_file.raw_data << message.raw_data
wiki_file.raw_data = "#{wiki_file.raw_data}#{message.raw_data}"
else
wiki_file = GitalyClient::WikiFile.new(message.to_h)
# All gRPC strings in a response are frozen, so we get
......@@ -160,7 +162,7 @@ module Gitlab
)
response = GitalyClient.call(@repository.storage, :wiki_service, :wiki_get_formatted_data, request)
response.reduce("") { |memo, msg| memo << msg.data }
response.reduce([]) { |memo, msg| memo << msg.data }.join
end
private
......
# frozen_string_literal: true
module Gitlab
module GitlabImport
class Client
......
# frozen_string_literal: true
module Gitlab
module GitlabImport
class Importer
......@@ -22,22 +24,22 @@ module Gitlab
issues = client.issues(project_identifier)
issues.each do |issue|
body = @formatter.author_line(issue["author"]["name"])
body += issue["description"]
body = [@formatter.author_line(issue["author"]["name"])]
body << issue["description"]
comments = client.issue_comments(project_identifier, issue["iid"])
if comments.any?
body += @formatter.comments_header
body << @formatter.comments_header
end
comments.each do |comment|
body += @formatter.comment(comment["author"]["name"], comment["created_at"], comment["body"])
body << @formatter.comment(comment["author"]["name"], comment["created_at"], comment["body"])
end
project.issues.create!(
iid: issue["iid"],
description: body,
description: body.join,
title: issue["title"],
state: issue["state"],
updated_at: issue["updated_at"],
......
# frozen_string_literal: true
module Gitlab
module GitlabImport
class ProjectCreator
......
# frozen_string_literal: true
module Gitlab
module GoogleCodeImport
class Client
......
# frozen_string_literal: true
module Gitlab
module GoogleCodeImport
class Importer
......
# frozen_string_literal: true
module Gitlab
module GoogleCodeImport
class ProjectCreator
......
# frozen_string_literal: true
module Gitlab
module GoogleCodeImport
class Repository
......
# frozen_string_literal: true
module Gitlab
module Gpg
class Commit
......
# frozen_string_literal: true
module Gitlab
module Gpg
class InvalidGpgSignatureUpdater
......
# frozen_string_literal: true
module Gitlab
module GrapeLogging
module Formatters
......
# frozen_string_literal: true
# This grape_logging module (https://github.com/aserafin/grape_logging) makes it
# possible to log how much time an API request was queued by Workhorse.
module Gitlab
......
# frozen_string_literal: true
# This grape_logging module (https://github.com/aserafin/grape_logging) makes it
# possible to log the user who performed the Grape API action by retrieving
# the user context from the request environment.
......
# frozen_string_literal: true
module Gitlab
module Graphql
# Allow fields to declare permissions their objects must have. The field
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Authorize
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Authorize
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Connections
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Connections
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Errors
......
# frozen_string_literal: true
module Gitlab
module Graphql
module ExposePermissions
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Present
......
# frozen_string_literal: true
module Gitlab
module Graphql
module Present
......
# frozen_string_literal: true
module Gitlab
module Graphql
class Variables
......
# frozen_string_literal: true
module Gitlab
module Graphs
class Commits
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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