diff options
author | James Lopez <james@jameslopez.es> | 2016-10-05 17:41:32 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-04-14 16:20:55 +0300 |
commit | 2951a8543ef97ceb1bcaca5f5140d822729c950b (patch) | |
tree | ff02540e813cd93e8df8a438c9b22cdacc96982e /lib/api/internal.rb | |
parent | b61199ce0ccdfcd11a338778ce300cd15e5f2a43 (diff) |
Add user activity service and spec. Also added relevant - NOT offline - migration
It uses a user activity table instead of a column in users.
Tested with mySQL and postgreSQL
Diffstat (limited to 'lib/api/internal.rb')
-rw-r--r-- | lib/api/internal.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 215bc03d0e9..d374d183dcd 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -15,6 +15,16 @@ module API # project - project path with namespace # action - git action (git-upload-pack or git-receive-pack) # changes - changes as "oldrev newrev ref", see Gitlab::ChangesList + helpers do + def log_user_activity(actor) + commands = Gitlab::GitAccess::DOWNLOAD_COMMANDS + + Gitlab::GitAccess::PUSH_COMMANDS + + Gitlab::GitAccess::GIT_ANNEX_COMMANDS + + ::Users::ActivityService.new(actor, 'Git SSH').execute if commands.include?(params[:action]) + end + end + post "/allowed" do status 200 @@ -40,6 +50,8 @@ module API response = { status: access_status.status, message: access_status.message } if access_status.status + log_user_activity(actor) + # Return the repository full path so that gitlab-shell has it when # handling ssh commands response[:repository_path] = |