double check admin key holders (#761)

This commit is contained in:
Echo 2026-01-03 09:08:08 -05:00 committed by GitHub
parent ae7d9c73fb
commit f406bec762
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,7 +13,14 @@ module Api
if @admin_api_key
@current_user = @admin_api_key.user
@current_user.admin_level.in?([ "admin", "superadmin", "viewer" ])
unless @current_user.admin_level.in?([ "admin", "superadmin", "viewer" ])
@admin_api_key.revoke!
render json: { error: "lmao no perms" }, status: :unauthorized
false
else
true
end
else
render json: { error: "lmao no perms" }, status: :unauthorized
end