repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/teams/migration_service.rb | app/services/teams/migration_service.rb | # frozen_string_literal: true
module Teams
class MigrationService < ::BaseService
attr_accessor :error
def execute(team, new_team)
raise ActiveRecord::RecordNotFound if team.nil? || new_team.nil?
return false if team.namespaces.empty?
return false if same_team?(team, new_team)
mig... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/teams/create_service.rb | app/services/teams/create_service.rb | # frozen_string_literal: true
module Teams
class CreateService < ::BaseService
def execute
@team = Team.new(params.except(:owner_id))
@team.owners << owner
create_activity! if @team.save
@team
end
private
def create_activity!
@team.create_activity(:create,
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/teams/destroy_service.rb | app/services/teams/destroy_service.rb | # frozen_string_literal: true
module Teams
class DestroyService < ::BaseService
attr_accessor :error
def execute(team, new_team = nil)
raise ActiveRecord::RecordNotFound if team.nil?
if new_team.present?
migrate_namespaces!(team, new_team)
else
destroy_namespaces!(team)
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/teams/update_service.rb | app/services/teams/update_service.rb | # frozen_string_literal: true
module Teams
class UpdateService < ::BaseService
include ::Helpers::ChangeNameDescription
def build
@team = Team.find(params[:id])
end
def execute
change_name_description(@team, :team, params[:team], team: @team.name)
end
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/helpers/change_name_description.rb | app/services/helpers/change_name_description.rb | # frozen_string_literal: true
module Helpers
# ChangeNameDescription adds a method which will properly handle updates on
# either the name or the description of the given object, while adding an
# activity for it.
module ChangeNameDescription
# Update the attributes name or description of a ActiveRecord-ob... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/tags/destroy_service.rb | app/services/tags/destroy_service.rb | # frozen_string_literal: true
module Tags
class DestroyService < ::BaseService
attr_accessor :error
def execute(tag)
raise ActiveRecord::RecordNotFound if tag.nil?
repository = tag.repository
tag_destroyed = tag.delete_by_digest!(current_user)
if tag_destroyed && repository.tags.em... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/team_users/create_service.rb | app/services/team_users/create_service.rb | # frozen_string_literal: true
module TeamUsers
class CreateService < ::BaseService
attr_accessor :team_user
def initialize(current_user, team_user = nil)
@current_user = current_user
@team_user = team_user
end
def execute
return if team_user.nil?
create_activity! if team_us... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/team_users/destroy_service.rb | app/services/team_users/destroy_service.rb | # frozen_string_literal: true
module TeamUsers
class DestroyService < ::TeamUsers::BaseService
def execute(team_user)
return false if team_user.nil?
return false unless owners_remaining?(team_user)
destroyed = team_user.destroy
create_activity!(team_user) if destroyed
destroyed
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/team_users/build_service.rb | app/services/team_users/build_service.rb | # frozen_string_literal: true
module TeamUsers
class BuildService < ::BaseService
def execute
team_user = build_team_user unless params.empty?
enforce_admin_owner!(team_user) unless team_user.nil?
team_user
end
private
# Always set role as owner if user is a Portus admin
def... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/team_users/base_service.rb | app/services/team_users/base_service.rb | # frozen_string_literal: true
module TeamUsers
class BaseService < ::BaseService
attr_reader :message
protected
# Responds with an error if the client is trying to remove the only owner of
# the team through either the update or the destroy methods.
def owners_remaining?(team_user)
return... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/team_users/update_service.rb | app/services/team_users/update_service.rb | # frozen_string_literal: true
module TeamUsers
class UpdateService < ::TeamUsers::BaseService
def execute(team_user)
return false if team_user.nil?
old_role = team_user.role
if demoting_admin?(team_user)
@message = "User cannot be demoted because it's a Portus admin"
return fa... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/namespaces/create_service.rb | app/services/namespaces/create_service.rb | # frozen_string_literal: true
module Namespaces
class CreateService < ::BaseService
attr_accessor :namespace
def initialize(current_user, namespace = nil)
@current_user = current_user
@namespace = namespace
end
def execute
return if namespace.nil?
create_activity! if namesp... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/namespaces/destroy_service.rb | app/services/namespaces/destroy_service.rb | # frozen_string_literal: true
module Namespaces
class DestroyService < ::BaseService
attr_accessor :error
def execute(namespace)
raise ActiveRecord::RecordNotFound if namespace.nil?
attempt_destroy!(namespace)
end
protected
# attempt_destroy! checks that there are no semantic erro... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/namespaces/build_service.rb | app/services/namespaces/build_service.rb | # frozen_string_literal: true
module Namespaces
class BuildService < ::BaseService
def execute
build_namespace unless params.empty?
end
private
def build_namespace
team = fetch_team
namespace_params = params.merge(
visibility: Namespace.visibilities[:visibility_private],
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/namespaces/update_service.rb | app/services/namespaces/update_service.rb | # frozen_string_literal: true
module Namespaces
class UpdateService < ::BaseService
include ::Helpers::ChangeNameDescription
include ::Portus::Errors
# Builds the referenced namespace.
def build
@namespace = Namespace.find(params[:id])
end
# The `build` method should be called before ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/repositories/destroy_service.rb | app/services/repositories/destroy_service.rb | # frozen_string_literal: true
module Repositories
class DestroyService < ::BaseService
attr_accessor :error
def execute(repository)
raise ActiveRecord::RecordNotFound if repository.nil?
mark_for_deletion!(repository)
tags_destroyed = destroy_tags(repository)
return false unless tags... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/repositories/update_service.rb | app/services/repositories/update_service.rb | # frozen_string_literal: true
module Repositories
class UpdateService < ::BaseService
def build
return if params[:id].blank?
@repository = Repository.find(params[:id])
end
def execute
return if @repository.blank?
@repository.update(params[:repository])
end
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/registries/create_service.rb | app/services/registries/create_service.rb | # frozen_string_literal: true
module Registries
class CreateService < ::Registries::BaseService
def execute
@registry = Registry.new(params)
@valid = @registry.valid?
@messages = @registry.errors.messages
@reachable = true
check!
if @valid
Namespace.update_all(r... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/registries/validate_service.rb | app/services/registries/validate_service.rb | # frozen_string_literal: true
module Registries
class ValidateService < ::BaseValidateService
def execute
@registry = Registry.new(registry_params)
@valid = @registry.valid?
@messages = @registry.errors.messages
check_reachability!
{ valid: valid?, messages: messages }
end
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/registries/base_service.rb | app/services/registries/base_service.rb | # frozen_string_literal: true
module Registries
class BaseService < ::BaseService
attr_reader :messages
attr_accessor :force
def valid?
@valid
end
def reachable?
@reachable
end
protected
def check_reachability!
msg = @registry.reachable?
return if msg.blank... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/services/registries/update_service.rb | app/services/registries/update_service.rb | # frozen_string_literal: true
module Registries
class UpdateService < ::Registries::BaseService
def execute
@registry = Registry.find(params[:id])
@messages = @registry.errors.messages
@registry.assign_attributes(params)
@valid = @registry.valid?
check!
if @valid
@mes... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/teams_helper.rb | app/helpers/teams_helper.rb | # frozen_string_literal: true
module TeamsHelper
include ::API::Helpers::Teams
def manage_teams_enabled?
APP_CONFIG.enabled?("user_permission.manage_team")
end
def can_create_team?
TeamPolicy.new(current_user, nil).create?
end
# Render the namespace scope icon.
def team_scope_icon(team)
if... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/activities_helper.rb | app/helpers/activities_helper.rb | # frozen_string_literal: true
# Common methods for activities used in other helpers.
module ActivitiesHelper
# Returns a string containing the username of the owner of the activity.
def activity_owner(activity)
activity_user(activity, :owner, :owner_name, "Someone")
end
# Returns activity action based on ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/sessions_helper.rb | app/helpers/sessions_helper.rb | # frozen_string_literal: true
#
# Renders the social login buttons if one of the `oauth` configuration has been enabled.
#
module SessionsHelper
def social_login
return unless APP_CONFIG["oauth"]
enabled_providers = APP_CONFIG["oauth"].find_all { |k, v| k != "local_login" && v["enabled"] }
render partia... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/search_helper.rb | app/helpers/search_helper.rb | # frozen_string_literal: true
module SearchHelper
def build_search_category_url(params, category)
"#{search_index_path}?utf8=#{params[:utf8]}&search=#{params[:search]}&type=#{category}"
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/webhooks_helper.rb | app/helpers/webhooks_helper.rb | # frozen_string_literal: true
module WebhooksHelper
def can_create_webhook?(namespace)
WebhookPolicy.new(current_user, namespace.webhooks.build).create?
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/registries_helper.rb | app/helpers/registries_helper.rb | # frozen_string_literal: true
module RegistriesHelper
# Render registry status icon
def registry_status_icon(registry)
error = registry.reachable?
msg = error.empty? ? "Reachable" : error
time = Time.now.getlocal.to_s(:rfc822)
icon = "chain"
icon += "-broken" unless error.empty?
title ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/repositories_helper.rb | app/helpers/repositories_helper.rb | # frozen_string_literal: true
# Rendering push activities can be tricky, since tags can come on go, and with
# them, dangling repositories that used to contain them. Because of this, this
# helper renders the proper HTML for push activities, while being safe at it.
# rubocop:disable Metrics/ModuleLength
module Reposit... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/application_helper.rb | app/helpers/application_helper.rb | # frozen_string_literal: true
module ApplicationHelper
include ActivitiesHelper
ACTION_ALIASES = {
"update" => "edit",
"create" => "new"
}.freeze
def app_host
request.env["HTTP_HOST"]
end
def app_relative_url_root
ENV["RAILS_RELATIVE_URL_ROOT"] || ""
end
def app_path
path = File... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/helpers/namespaces_helper.rb | app/helpers/namespaces_helper.rb | # frozen_string_literal: true
require "api/helpers/namespaces"
module NamespacesHelper
# TODO: remove on future refactor
include API::Helpers::Namespaces
def can_create_namespace?
current_user.admin? || APP_CONFIG.enabled?("user_permission.create_namespace")
end
# Render the name for the namespace fro... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/registry_policy.rb | app/policies/registry_policy.rb | # frozen_string_literal: true
# RegistryPolicy implements the authorization policy for methods inside the
# "registry" type.
class RegistryPolicy
attr_reader :user
def initialize(user, _)
raise Pundit::NotAuthorizedError, "must be logged in" unless user
@user = user
end
# This method defines the per... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/repository_policy.rb | app/policies/repository_policy.rb | # frozen_string_literal: true
class RepositoryPolicy
attr_reader :user, :repository, :namespace
def initialize(user, repository)
@user = user
@repository = repository
@namespace = repository.namespace
end
def show?
return namespace.visibility_public? unless @user
@user.admin? ||
na... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/comment_policy.rb | app/policies/comment_policy.rb | # frozen_string_literal: true
class CommentPolicy
attr_reader :user, :comment
def initialize(user, comment)
@user = user
@comment = comment
end
# Allows the admin to write comments
# Allows all members of a team to comment on their repos
# Allows all users to comment on repos under a protected or... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/webhook_policy.rb | app/policies/webhook_policy.rb | # frozen_string_literal: true
class WebhookPolicy < NamespacePolicy
attr_reader :webhook
def initialize(user, webhook)
raise Pundit::NotAuthorizedError, "must be logged in" unless user
@user = user
@webhook = webhook
@namespace = webhook.namespace
end
def create?
create_or_manage?("crea... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/namespace_policy.rb | app/policies/namespace_policy.rb | # frozen_string_literal: true
class NamespacePolicy
attr_reader :user, :namespace
def initialize(user, namespace)
@user = user
@namespace = namespace
end
# rubocop:disable Metrics/CyclomaticComplexity
def pull?
# If user is portus, it can pull anything
return true if user&.portus?
# Ev... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/webhook_delivery_policy.rb | app/policies/webhook_delivery_policy.rb | # frozen_string_literal: true
class WebhookDeliveryPolicy < WebhookPolicy
attr_reader :webhook_delivery
def initialize(user, webhook_delivery)
raise Pundit::NotAuthorizedError, "must be logged in" unless user
@user = user
@webhook_delivery = webhook_delivery
@webhook = webhook_delivery.webhook
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/webhook_header_policy.rb | app/policies/webhook_header_policy.rb | # frozen_string_literal: true
class WebhookHeaderPolicy < WebhookPolicy
attr_reader :webhook_header
def initialize(user, webhook_header)
raise Pundit::NotAuthorizedError, "must be logged in" unless user
@user = user
@webhook_header = webhook_header
@webhook = webhook_header.webhook
@namespac... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/team_user_policy.rb | app/policies/team_user_policy.rb | # frozen_string_literal: true
# Policy for team members. It does not authorize anything unless the author of
# the action is an owner. An owner is either an admin of Portus or an owner of
# the team itself.
class TeamUserPolicy
attr_reader :user, :team_user
def initialize(user, team_user)
raise Pundit::NotAut... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/application_token_policy.rb | app/policies/application_token_policy.rb | # frozen_string_literal: true
class ApplicationTokenPolicy
attr_reader :user, :application_token
def initialize(user, application_token)
raise Pundit::NotAuthorizedError, "must be logged in" unless user
@user = user
@application_token = application_token
end
def destroy?
user.id == applicati... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/team_policy.rb | app/policies/team_policy.rb | # frozen_string_literal: true
class TeamPolicy
attr_reader :user, :team
def initialize(user, team)
raise Pundit::NotAuthorizedError, "must be logged in" unless user
@user = user
@team = team
end
def member?
user.admin? || team.users.exists?(user.id)
end
def owner?
user.admin? || tea... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/tag_policy.rb | app/policies/tag_policy.rb | # frozen_string_literal: true
# Defines the policy for the tag object.
class TagPolicy
attr_reader :user, :tag
def initialize(user, tag)
@user = user
@tag = tag
end
def show?
@user.admin? ||
@tag.repository.namespace.visibility_public? ||
@tag.repository.namespace.visibility_protected... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/policies/public_activity/activity_policy.rb | app/policies/public_activity/activity_policy.rb | # frozen_string_literal: true
class PublicActivity::ActivityPolicy
class Scope
attr_reader :user, :scope
def initialize(user, scope)
@user = user
@scope = scope
end
def resolve(count = 20)
teams_ids = @user.teams.collect(&:id)
public_visibility = Namespace.visibilities[:visi... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/validators/unique_tag_validator.rb | app/validators/unique_tag_validator.rb | # frozen_string_literal: true
require "portus/db"
# See https://github.com/SUSE/Portus/pull/1494 on why we didn't use the
# `uniqueness` constraint directly.
#
# NOTE: if we ever remove MySQL support, replace this with the proper validator.
class UniqueTagValidator < ActiveModel::EachValidator
def validate_each(rec... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/validators/http_validator.rb | app/validators/http_validator.rb | # frozen_string_literal: true
require "uri"
# Validates URLs and transforms them into valid ones if needed.
class HttpValidator < ActiveModel::EachValidator
# Validator for the url.
def validate_each(record, attribute, value)
uri = URI.parse(value)
return if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/validators/namespace_validator.rb | app/validators/namespace_validator.rb | # frozen_string_literal: true
# Validates the name of the namespace as specified by Docker Distribution.
class NamespaceValidator < ActiveModel::EachValidator
NAME_REGEXP = /\A[a-z0-9]+(?:[._\\-][a-z0-9]+)*\Z/.freeze
# Validator for the name.
def validate_each(record, attribute, value)
# Already validated b... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/help_controller.rb | app/controllers/help_controller.rb | # frozen_string_literal: true
# HelpController holds the methods for rendering the help pages inside of Portus.
class HelpController < ApplicationController
# Main help page.
def index; end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/namespaces_controller.rb | app/controllers/namespaces_controller.rb | # frozen_string_literal: true
class NamespacesController < ApplicationController
before_action :set_namespace, only: %i[show]
after_action :verify_authorized, except: %i[index typeahead]
after_action :verify_policy_scoped, only: :index
# GET /namespaces
def index
respond_to do |format|
format.htm... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/tags_controller.rb | app/controllers/tags_controller.rb | # frozen_string_literal: true
class TagsController < ApplicationController
def show
@tag = Tag.includes(:repository, :namespace).find(params[:id])
@repository = @tag.repository
@namespace = @tag.repository.namespace
authorize @tag
@tag_serialized = API::Entities::Tags.represent(
@tag,
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/webhooks_controller.rb | app/controllers/webhooks_controller.rb | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
# WebhooksController manages the creation/removal/update of webhooks.
# Also, it manages their state, i.e. enabled/disabled.
class WebhooksController < ApplicationController
before_action :set_namespace
before_action :set_webhook, except: %i[inde... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/dashboard_controller.rb | app/controllers/dashboard_controller.rb | # frozen_string_literal: true
class DashboardController < ApplicationController
def index
@recent_activities = policy_scope(PublicActivity::Activity)
.limit(20)
.order(id: :desc)
if current_user.admin?
@admin_recent_activities = PublicActivity::Activity... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/passwords_controller.rb | app/controllers/passwords_controller.rb | # frozen_string_literal: true
# PasswordsController is a Devise controller that takes care of the "password
# forgotten" mechanism.
class PasswordsController < Devise::PasswordsController
layout "authentication"
before_action :check_portus, only: %i[create]
include CheckLDAP
# Re-implemented from Devise to ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/repositories_controller.rb | app/controllers/repositories_controller.rb | # frozen_string_literal: true
class RepositoriesController < ApplicationController
include WithPagination
include WithOrdering
before_action :set_repository, only: %i[show toggle_star]
# GET /repositories/team
def team_repositories
@team_repositories = Repository
.joins(namespa... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/comments_controller.rb | app/controllers/comments_controller.rb | # frozen_string_literal: true
class CommentsController < ApplicationController
before_action :set_repository
# POST /repositories/1/comments
# POST /repositories/1/comments.json
def create
@comment = @repository.comments.new(params.require(:comment).permit(:body))
@comment.author = current_user
au... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/errors_controller.rb | app/controllers/errors_controller.rb | # frozen_string_literal: true
# We use our own error routes because we need to display pages for bad server
# configurations too. Moreover, this way we get richer pages while sharing as
# much code as possible.
class ErrorsController < ApplicationController
respond_to :html, :csv
skip_before_action :check_require... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/teams_controller.rb | app/controllers/teams_controller.rb | # frozen_string_literal: true
class TeamsController < ApplicationController
before_action :set_team, only: %i[show typeahead]
after_action :verify_policy_scoped, only: :index
# GET /teams
def index
@teams = policy_scope(Team)
@teams_serialized = API::Entities::Teams.represent(
@teams,
curr... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/explore_controller.rb | app/controllers/explore_controller.rb | # frozen_string_literal: true
# ExploreController exposes a search interface for non-logged in (anonymous)
# users. It allows these users to search for public repositories.
class ExploreController < ActionController::Base
protect_from_forgery with: :exception
before_action :feature_enabled, only: [:index]
incl... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/application_controller.rb | app/controllers/application_controller.rb | # frozen_string_literal: true
require "portus/auth_from_token"
class ApplicationController < ActionController::Base
include ::Portus::Checks
before_action :check_requirements
include ::Portus::AuthFromToken
before_action :authenticate_user_from_authentication_token!
before_action :authenticate_user!
bef... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/search_controller.rb | app/controllers/search_controller.rb | # frozen_string_literal: true
class SearchController < ApplicationController
def index
search = params[:search].split(":").first
@repositories = policy_scope(Repository).search(search)
@teams = policy_scope(Team).search(search)
@namespaces = policy_scope(Namespace).search(search)
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/webhook_headers_controller.rb | app/controllers/webhook_headers_controller.rb | # frozen_string_literal: true
# WebhookHeadersController manages the creation/removal of webhook headers.
class WebhookHeadersController < ApplicationController
before_action :set_namespace
before_action :set_webhook
after_action :verify_authorized
# POST /namespaces/1/webhooks/1/headers
# POST /namespaces... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/webhook_deliveries_controller.rb | app/controllers/webhook_deliveries_controller.rb | # frozen_string_literal: true
# WebhookDeliveriesController manages the updates of webhook deliveries.
class WebhookDeliveriesController < ApplicationController
respond_to :html, :js
after_action :verify_authorized
# PATCH/PUT /namespaces/1/webhooks/1/deliveries/1
def update
namespace = Namespace.find(pa... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/concerns/with_ordering.rb | app/controllers/concerns/with_ordering.rb | # frozen_string_literal: true
# Concern for handling of ordering parameters.
module WithOrdering
extend ActiveSupport::Concern
include ::API::Helpers::Ordering
included do
before_action :default_ordering_params
end
# Adds some default ordering parameters.
def default_ordering_params
params[:sort... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/concerns/session_flash.rb | app/controllers/concerns/session_flash.rb | # frozen_string_literal: true
# SessionFlash adds the `session_flash` method which deals with flashy messages
# on signup/login, while notifying users about their personal namespace.
module SessionFlash
extend ActiveSupport::Concern
# Sets the flash object accordingly for the given authenticated user. The
# met... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/concerns/check_ldap.rb | app/controllers/concerns/check_ldap.rb | # frozen_string_literal: true
# CheckLDAP redirects the user to the new_user_session_path if LDAP support is
# enabled. A `before_action` will be created for the :new and the :create
# methods.
module CheckLDAP
extend ActiveSupport::Concern
included do
# rubocop:disable Rails/LexicallyScopedActionFilter
b... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/concerns/headers.rb | app/controllers/concerns/headers.rb | # frozen_string_literal: true
# Concern which has methods dealing with headers that might be interesting for
# controllers deriving directly from ActionController::Base.
module Headers
extend ActiveSupport::Concern
included do
after_action :default_headers
end
# Adds some default headers.
def default_h... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/concerns/with_pagination.rb | app/controllers/concerns/with_pagination.rb | # frozen_string_literal: true
# Concern for handling of pagination parameters.
module WithPagination
extend ActiveSupport::Concern
include ::API::Helpers::Pagination
included do
before_action :default_pagination_params
end
# Adds some default pagination parameters.
def default_pagination_params
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/auth/omniauth_callbacks_controller.rb | app/controllers/auth/omniauth_callbacks_controller.rb | # frozen_string_literal: true
class Auth::OmniauthCallbacksController < Devise::OmniauthCallbacksController
skip_before_action :verify_authenticity_token
# rubocop:disable Rails/LexicallyScopedActionFilter
before_action :check_user, except: [:failure]
# rubocop:enable Rails/LexicallyScopedActionFilter
# GE... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/auth/registrations_controller.rb | app/controllers/auth/registrations_controller.rb | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
class Auth::RegistrationsController < Devise::RegistrationsController
layout "authentication", except: :edit
include CheckLDAP
include SessionFlash
before_action :check_signup, only: %i[new create]
before_action :check_admin, only: %i[new ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/auth/omniauth_registrations_controller.rb | app/controllers/auth/omniauth_registrations_controller.rb | # frozen_string_literal: true
class Auth::OmniauthRegistrationsController < ApplicationController
layout "authentication"
skip_before_action :authenticate_user!
# GET /users/oauth
def new
if session["omniauth.auth"]
@user = User.new(
username: session["omniauth.auth"]["info"]["username"]... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/auth/sessions_controller.rb | app/controllers/auth/sessions_controller.rb | # frozen_string_literal: true
class Auth::SessionsController < Devise::SessionsController
include SessionFlash
layout "authentication"
# Re-implementing. The logic is: if there is already a user that can log in
# or LDAP support is enabled, work as usual. Otherwise, redirect always to
# the signup page.
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/admin/users_controller.rb | app/controllers/admin/users_controller.rb | # frozen_string_literal: true
class Admin::UsersController < Admin::BaseController
before_action :another_user_access, only: %i[edit]
before_action :check_ldap_user!, only: %i[create]
def index
@admin_count = User.admins.count
@users = User.not_portus.order(:username)
@users_serialized = API::Entiti... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/admin/base_controller.rb | app/controllers/admin/base_controller.rb | # frozen_string_literal: true
class Admin::BaseController < ApplicationController
before_action :ensure_admin!
protected
def ensure_admin!
deny_access unless current_user.admin?
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/admin/activities_controller.rb | app/controllers/admin/activities_controller.rb | # frozen_string_literal: true
require "csv"
class Admin::ActivitiesController < Admin::BaseController
respond_to :html, :csv
def index
respond_to do |format|
format.html do
@activities = PublicActivity::Activity.order(created_at: :desc).page(params[:page])
end
format.csv do
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/admin/registries_controller.rb | app/controllers/admin/registries_controller.rb | # frozen_string_literal: true
# Allows the creation of exactly one registry. It also allows updating the
# "use_ssl" attribute of a given registry. Doing all this is safe because only
# admin users will be able to reach this controller.
class Admin::RegistriesController < Admin::BaseController
before_action :registr... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/api/base_controller.rb | app/controllers/api/base_controller.rb | # frozen_string_literal: true
class Api::BaseController < ActionController::Base
class ScopeNotHandled < StandardError; end
class RegistryNotHandled < StandardError; end
include Pundit
respond_to :json
rescue_from Pundit::NotAuthorizedError, with: :deny_access
rescue_from ScopeNotHandled, with: :deny_ac... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/api/v2/ping_controller.rb | app/controllers/api/v2/ping_controller.rb | # frozen_string_literal: true
class Api::V2::PingController < Api::BaseController
def ping
authenticate_user!
head :ok
end
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/api/v2/events_controller.rb | app/controllers/api/v2/events_controller.rb | # frozen_string_literal: true
# This is the endpoint being used to handle notifications from the Registry.
class Api::V2::EventsController < Api::BaseController
# A new notification is coming, register it if valid.
def create
body = JSON.parse(request.body.read)
Portus::RegistryNotification.process!(body)
... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/controllers/api/v2/tokens_controller.rb | app/controllers/api/v2/tokens_controller.rb | # frozen_string_literal: true
# TokensController is used to deliver the token that the docker client should
# use in order to perform operation into the registry. This is the last step in
# the authentication process for Portus' point of view.
class Api::V2::TokensController < Api::BaseController
before_action :atte... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/tag.rb | app/models/tag.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: tags
#
# id :integer not null, primary key
# name :string(255) default("latest"), not null
# repository_id :integer not null
# created_at :datetime not null
# updated_at :datetime ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/star.rb | app/models/star.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: stars
#
# id :integer not null, primary key
# user_id :integer
# repository_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_stars_on_repository_i... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/repository.rb | app/models/repository.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: repositories
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# namespace_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# marked ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/registry_event.rb | app/models/registry_event.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: registry_events
#
# id :integer not null, primary key
# event_id :string(255) default("")
# created_at :datetime not null
# updated_at :datetime not null
# status :integer default("done")
# ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/namespace.rb | app/models/namespace.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: namespaces
#
# id :integer not null, primary key
# name :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# team_id :integer
# registry_id :integer not null
# ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/registry.rb | app/models/registry.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: registries
#
# id :integer not null, primary key
# name :string(255) not null
# hostname :string(255) not null
# created_at :datetime not null
# updated_at :datetime ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/team_user.rb | app/models/team_user.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: team_users
#
# id :integer not null, primary key
# user_id :integer
# team_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# role :integer default("viewer")
#
# ... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/comment.rb | app/models/comment.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: comments
#
# id :integer not null, primary key
# body :text(65535)
# repository_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
#
# Indexes... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/vulnerability.rb | app/models/vulnerability.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: vulnerabilities
#
# id :integer not null, primary key
# name :string(255) not null
# scanner :string(255) default(""), not null
# severity :string(255) default(""), not null
# link :string(2... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/application_record.rb | app/models/application_record.rb | # frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/webhook_delivery.rb | app/models/webhook_delivery.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: webhook_deliveries
#
# id :integer not null, primary key
# webhook_id :integer
# uuid :string(255)
# status :integer
# request_header :text(65535)
# request_body :text(65535)
# response_heade... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/application_token.rb | app/models/application_token.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: application_tokens
#
# id :integer not null, primary key
# application :string(255) not null
# token_hash :string(255) not null
# token_salt :string(255) not null
# user_id :integer not null
#
# I... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/team.rb | app/models/team.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: teams
#
# id :integer not null, primary key
# name :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# hidden :boolean defaul... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/webhook_header.rb | app/models/webhook_header.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: webhook_headers
#
# id :integer not null, primary key
# webhook_id :integer
# name :string(255)
# value :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# i... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/webhook.rb | app/models/webhook.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: webhooks
#
# id :integer not null, primary key
# namespace_id :integer
# url :string(255)
# username :string(255)
# password :string(255)
# request_method :integer
# content_type :integer
# ena... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/scan_result.rb | app/models/scan_result.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: scan_results
#
# id :integer not null, primary key
# tag_id :integer
# vulnerability_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/user.rb | app/models/user.rb | # frozen_string_literal: true
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# username :string(255) default(""), not null
# email :string(255) default("")
# encrypted_password :string(255) default("... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/activity/fallback.rb | app/models/activity/fallback.rb | # frozen_string_literal: true
# Activity holds utility methods to update activity records depending on the
# model including this module.
module Activity
# Fallback has a set of methods that manage trackable types for existing
# activities.
module Fallback
# fallback_activity updates the model including this... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/namespace/auth_scope.rb | app/models/namespace/auth_scope.rb | # frozen_string_literal: true
# Namespace::AuthScope parses the scope string for the "namespace" type.
class Namespace::AuthScope < Portus::AuthScope
attr_accessor :actions, :resource_type, :resource_name
def resource
resource = if @namespace_name.blank?
@registry.namespaces.find_by(global: t... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/models/registry/auth_scope.rb | app/models/registry/auth_scope.rb | # frozen_string_literal: true
# Registry::AuthScope parses the scope string so it can be used afterwards for
# the "registry" type.
class Registry::AuthScope < Portus::AuthScope
def resource
reg = Registry.by_hostname_or_external(@registry.hostname)
raise ResourceNotFound, "Could not find registry #{@registr... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/app/mailers/devise_mailer.rb | app/mailers/devise_mailer.rb | # frozen_string_literal: true
# DeviseMailer is the mailer being used by Devise.
class DeviseMailer < Devise::Mailer
default from: "#{APP_CONFIG["email"]["name"]} <#{APP_CONFIG["email"]["from"]}>"
default reply_to: APP_CONFIG["email"]["reply_to"] if APP_CONFIG["email"]["reply_to"].present?
end
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/db/seeds.rb | db/seeds.rb | # frozen_string_literal: true
# Adding the Portus user.
if User.any?
Rails.logger.fatal "The DB is not empty! Only seed for kick-starting your DB"
exit(-1)
end
Rails.logger.info "Adding the \"portus\" user"
User.create_portus_user!
| ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
SUSE/Portus | https://github.com/SUSE/Portus/blob/2843437742515c1f0896fafaee166cde336f5b18/db/schema.mysql.rb | db/schema.mysql.rb | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | ruby | Apache-2.0 | 2843437742515c1f0896fafaee166cde336f5b18 | 2026-01-04T15:51:56.938548Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.