diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/spam_logs_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 20 | ||||
-rw-r--r-- | app/controllers/projects/ml/model_versions_controller.rb | 24 |
3 files changed, 47 insertions, 1 deletions
diff --git a/app/controllers/admin/spam_logs_controller.rb b/app/controllers/admin/spam_logs_controller.rb index b27185a6add..d7ed6aa33ef 100644 --- a/app/controllers/admin/spam_logs_controller.rb +++ b/app/controllers/admin/spam_logs_controller.rb @@ -5,7 +5,9 @@ class Admin::SpamLogsController < Admin::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def index - @spam_logs = SpamLog.includes(:user).order(id: :desc).page(params[:page]).without_count + @spam_logs = SpamLog.preload(user: [:trusted_with_spam_attribute]) + .order(id: :desc) + .page(params[:page]).without_count end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 50e0c5cc5ff..9634257209d 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -164,6 +164,26 @@ class Admin::UsersController < Admin::ApplicationController end end + def trust + result = Users::TrustService.new(current_user).execute(user) + + if result[:status] == :success + redirect_back_or_admin_user(notice: _("Successfully trusted")) + else + redirect_back_or_admin_user(alert: _("Error occurred. User was not updated")) + end + end + + def untrust + result = Users::UntrustService.new(current_user).execute(user) + + if result[:status] == :success + redirect_back_or_admin_user(notice: _("Successfully untrusted")) + else + redirect_back_or_admin_user(alert: _("Error occurred. User was not updated")) + end + end + def confirm if update_user(&:force_confirm) redirect_back_or_admin_user(notice: _("Successfully confirmed")) diff --git a/app/controllers/projects/ml/model_versions_controller.rb b/app/controllers/projects/ml/model_versions_controller.rb new file mode 100644 index 00000000000..bc69f5bf144 --- /dev/null +++ b/app/controllers/projects/ml/model_versions_controller.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Projects + module Ml + class ModelVersionsController < ::Projects::ApplicationController + before_action :authorize_read_model_registry! + feature_category :mlops + + def show + @model_version = ::Ml::ModelVersion.by_project_id_and_id(@project, params[:model_version_id]) + + return render_404 unless @model_version + + @model = @model_version.model + end + + private + + def authorize_read_model_registry! + render_404 unless can?(current_user, :read_model_registry, @project) + end + end + end +end |