gitlab-org--gitlab-foss/lib/gitlab/git/user.rb
David Turner dbcf48af8b Add username as GL_USERNAME in hooks (http)
When calling pre-receive, post-receive, and update hooks, add the GitLab
username as the GL_USERNAME environment variable.

This patch only handles cases where pushes are over http, or via
the web interface.  Later, we will address the ssh case.
2017-09-29 18:12:03 -04:00

22 lines
552 B
Ruby

module Gitlab
module Git
class User
attr_reader :username, :name, :email, :gl_id
def self.from_gitlab(gitlab_user)
new(gitlab_user.username, gitlab_user.name, gitlab_user.email, Gitlab::GlId.gl_id(gitlab_user))
end
def initialize(username, name, email, gl_id)
@username = username
@name = name
@email = email
@gl_id = gl_id
end
def ==(other)
[username, name, email, gl_id] == [other.username, other.name, other.email, other.gl_id]
end
end
end
end