gitlab-org--gitlab-foss/app/controllers/projects/container_registry_controller.rb

35 lines
842 B
Ruby
Raw Normal View History

2016-05-08 16:50:30 -04:00
class Projects::ContainerRegistryController < Projects::ApplicationController
before_action :verify_registry_enabled
before_action :authorize_read_container_image!
before_action :authorize_update_container_image!, only: [:destroy]
2016-05-08 16:50:30 -04:00
layout 'project'
def index
@tags = container_registry_repository.tags
2016-05-08 16:50:30 -04:00
end
def destroy
2016-05-18 12:22:28 -04:00
url = namespace_project_container_registry_index_path(project.namespace, project)
2016-05-08 16:50:30 -04:00
if tag.delete
2016-05-18 12:22:28 -04:00
redirect_to url
2016-05-08 16:50:30 -04:00
else
2016-05-18 12:22:28 -04:00
redirect_to url, alert: 'Failed to remove tag'
2016-05-08 16:50:30 -04:00
end
end
private
def verify_registry_enabled
render_404 unless Gitlab.config.registry.enabled
end
def container_registry_repository
@container_registry_repository ||= project.container_registry_repository
2016-05-08 16:50:30 -04:00
end
def tag
@tag ||= container_registry_repository.tag(params[:id])
2016-05-08 16:50:30 -04:00
end
end