refact
This commit is contained in:
@@ -43,7 +43,7 @@ module WarpEngine
|
||||
token = current_application_token
|
||||
return true if token.nil? || token.unrestricted?
|
||||
|
||||
software = WarpEngine::Software.find_by(name: name)
|
||||
software = WarpEngine::Software.kept.find_by(name: name)
|
||||
return true if software.nil? || software.owner_id.nil?
|
||||
|
||||
software.owner_type == token.owner_type && software.owner_id == token.owner_id
|
||||
@@ -53,7 +53,7 @@ module WarpEngine
|
||||
token = current_application_token
|
||||
return if token.nil? || token.unrestricted?
|
||||
|
||||
software = WarpEngine::Software.find_by(name: name)
|
||||
software = WarpEngine::Software.kept.find_by(name: name)
|
||||
return if software.nil? || software.owner_id.present?
|
||||
|
||||
software.update_columns(owner_type: token.owner_type, owner_id: token.owner_id)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require "warp_engine/access_denied"
|
||||
|
||||
module WarpEngine
|
||||
class ApiController < ActionController::API
|
||||
resource_description do
|
||||
@@ -10,7 +12,7 @@ module WarpEngine
|
||||
include WarpEngine::ApiErrorRendering
|
||||
include WarpEngine::SubjectAuthentication
|
||||
|
||||
rescue_from WarpEngine::DownloadService::Denied do
|
||||
rescue_from WarpEngine::AccessDenied do
|
||||
render json: { error: "Forbidden" }, status: :forbidden
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user