mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Add API scope for /logs route (#24956)
Adds an API scope for accessing Logster's routes. This one is a bit different than routes from core because it is mounted like ``` mount Logster::Web => "/logs" ``` and doesn't have all the route info a traditional rails app/engine does.
This commit is contained in:
@@ -234,6 +234,11 @@ class ApiKeyScope < ActiveRecord::Base
|
||||
actions: %w[users#create groups#index],
|
||||
},
|
||||
},
|
||||
logs: {
|
||||
messages: {
|
||||
actions: [Logster::Web],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
parse_resources!(mappings)
|
||||
@@ -291,6 +296,11 @@ class ApiKeyScope < ActiveRecord::Base
|
||||
if actions.include?(action) && api_supported_path && !excluded_paths.include?(path)
|
||||
urls << "#{engine_mount_path}#{path} (#{route.verb})"
|
||||
end
|
||||
|
||||
if actions.include?(Logster::Web)
|
||||
urls << "/logs/messages.json (POST)"
|
||||
urls << "/logs/show/:id.json (GET)"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user