Class: Gitlab::GitAuditEvent
- Inherits:
-
Object
- Object
- Gitlab::GitAuditEvent
- Defined in:
- lib/gitlab/git_audit_event.rb
Overview
rubocop:disable Gitlab/NamespacedClass
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(player, project) ⇒ GitAuditEvent
constructor
A new instance of GitAuditEvent.
- #send_audit_event(msg) ⇒ Object
Constructor Details
#initialize(player, project) ⇒ GitAuditEvent
Returns a new instance of GitAuditEvent.
7 8 9 10 11 |
# File 'lib/gitlab/git_audit_event.rb', line 7 def initialize(player, project) @project = project @author = player.is_a?(::API::Support::GitAccessActor) ? player.deploy_key_or_user : player @user = player.is_a?(::API::Support::GitAccessActor) ? player.user : player end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
5 6 7 |
# File 'lib/gitlab/git_audit_event.rb', line 5 def @author end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
5 6 7 |
# File 'lib/gitlab/git_audit_event.rb', line 5 def project @project end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/gitlab/git_audit_event.rb', line 5 def user @user end |
Instance Method Details
#send_audit_event(msg) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gitlab/git_audit_event.rb', line 13 def send_audit_event(msg) return if user.blank? || project.blank? audit_context = { name: 'repository_git_operation', stream_only: true, author: , scope: project, target: project, message: msg } ::Gitlab::Audit::Auditor.audit(audit_context) end |