forked from Trustie/forgeplus
29 lines
766 B
Ruby
29 lines
766 B
Ruby
class Api::V1::Projects::ScaController < Api::V1::BaseController
|
|
before_action :require_public_and_member_above
|
|
before_action :load_project
|
|
def index
|
|
@auth_token, @result = Api::V1::Projects::Sca::ShowProjectService.call(@project)
|
|
set_sca_cookie
|
|
end
|
|
def create
|
|
result = Api::V1::Projects::Sca::CreateProjectService.call(@project)
|
|
if result
|
|
@auth_token, @result = Api::V1::Projects::Sca::ShowProjectService.call(@project)
|
|
set_sca_cookie
|
|
else
|
|
{
|
|
auth_token: nil,
|
|
"url": nil,
|
|
}
|
|
end
|
|
end
|
|
|
|
private
|
|
def set_sca_cookie
|
|
cookies[:sca_token] = {
|
|
:value => @auth_token[:json]["token"],
|
|
:expires => 1.hours.from_now,
|
|
:domain => Trace.trace_config[:cookie_domain]
|
|
}
|
|
end
|
|
end |