-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
app/controllers/api/v1/release_engines/oci/tags_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
module Api::V1::ReleaseEngines | ||
class Oci::TagsController < Api::V1::BaseController | ||
before_action :require_ee! | ||
before_action :scope_to_current_account! | ||
before_action :require_active_subscription! | ||
before_action :authenticate_with_token | ||
before_action :set_package | ||
|
||
def index | ||
authorize! package, to: :show? | ||
|
||
releases = authorized_scope(package.releases) | ||
authorize! releases | ||
|
||
tags = releases.pluck(:tag) | ||
.sort | ||
|
||
render json: { | ||
name: package.key, | ||
tags:, | ||
} | ||
end | ||
|
||
private | ||
|
||
attr_reader :package | ||
|
||
def require_ee! = super(entitlements: %i[oci_engine]) | ||
|
||
def set_package | ||
scoped_packages = authorized_scope(current_account.release_packages.oci) | ||
|
||
@package = Current.resource = FindByAliasService.call( | ||
scoped_packages, | ||
id: params[:package], | ||
aliases: :key, | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters