Skip to content

Commit

Permalink
Create log token for public repos with log access enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiMysko committed Oct 14, 2022
1 parent 4ba8710 commit e9bbb06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/travis/api/v3/models/log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def repository_private?
job.repository.private?
end

def repository
@repository ||= Travis::API::V3::Models::Repository.find(job.repository.id)
end

private

def archived_log_part
Expand Down
2 changes: 1 addition & 1 deletion lib/travis/api/v3/renderer/log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def render(representation)
if raw_log_href !~ /^\/v3/
raw_log_href = "/v3#{raw_log_href}"
end
if enterprise? || model.repository_private?
if enterprise? || model.repository_private? || model.repository.user_settings.job_log_access_based_limit
token = LogToken.create(model.job, access_control&.user&.id)
raw_log_href += "?log.token=#{token}"
end
Expand Down

0 comments on commit e9bbb06

Please sign in to comment.