Files
adamantium/slices/admin/config/authenticated_admin_action.rb
2023-12-02 20:36:29 +11:00

13 lines
370 B
Ruby

require "adamantium/middleware/authenticate"
module Adamantium
class AuthenticatedAdminAction
def self.call(action:)
auth_proc = ->(id) { Admin::Container["repos.user_repo"].exists(id) }
action_proc = ->(env) { Admin::Container["actions.#{action}"].call(env) }
Adamantium::Middleware::Authenticate.new(action_proc, auth_proc)
end
end
end