feat(ntfy): dispatch api_key_revoked from ApiKey#revoke!
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
class ApiKey < ApplicationRecord
|
||||
include NtfyDispatchable
|
||||
|
||||
# Normalize permissions to always be a Hash
|
||||
attribute :permissions, :jsonb, default: {}
|
||||
|
||||
@@ -56,6 +58,12 @@ class ApiKey < ApplicationRecord
|
||||
# Revoke API key
|
||||
def revoke!
|
||||
update!(active: false)
|
||||
|
||||
self.class.dispatch_ntfy("api_key_revoked",
|
||||
title: "API key revoked",
|
||||
message: "API key '#{name}' (#{key_prefix}...) was revoked",
|
||||
priority: 3,
|
||||
tags: ["key", "no_entry"])
|
||||
end
|
||||
|
||||
# Deactivate expired keys
|
||||
|
||||
Reference in New Issue
Block a user