mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-20 00:35:22 +00:00
double check admin key holders (#761)
This commit is contained in:
parent
ae7d9c73fb
commit
f406bec762
1 changed files with 8 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue