Skip to content
Snippets Groups Projects

Audit events for project access tokens

Merged Serena Fang requested to merge project-access-token-audit-events into master
All threads resolved!
1 file
+ 2
6
Compare changes
  • Side-by-side
  • Inline
@@ -5,16 +5,12 @@ module ResourceAccessTokens
module CreateService
def execute
super.tap do |response|
log_audit_event(response.payload[:access_token], response)
audit_event_service(response.payload[:access_token], response)
end
end
private
def log_audit_event(token, response)
audit_event_service(token, response).for_user(full_path: token&.user&.username, entity_id: token&.user&.id).security_event
end
def audit_event_service(token, response)
message = if response.success?
"Created #{resource_type} access token with id #{token.user.id}"
@@ -29,7 +25,7 @@ def audit_event_service(token, response)
action: :custom,
custom_message: message,
ip_address: ip_address
)
).security_event
end
end
end
Loading