Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-20 03:11:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-20 03:11:14 +0300
commit1533e64a2ca36d119ba2f229f591e4b50c436338 (patch)
tree36ff2c216e0b899189207f760a8d58396a87a54d /app/controllers
parentb6bf52d3e274bd060a7b7e7a2812fda30e0d66d5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/spam_logs_controller.rb4
-rw-r--r--app/controllers/admin/users_controller.rb20
-rw-r--r--app/controllers/projects/ml/model_versions_controller.rb24
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