Commit aee60e7d authored by Peter Hegman's avatar Peter Hegman Committed by Thong Kuah

Add the ability to ban users in the Admin Area

Banned users are blocked, and their issues are hidden.

Changelog: added
parent 6cfa36b0
......@@ -370,7 +370,7 @@ class Admin::UsersController < Admin::ApplicationController
end
def check_ban_user_feature_flag
access_denied! unless Feature.enabled?(:ban_user_feature_flag)
access_denied! unless Feature.enabled?(:ban_user_feature_flag, default_enabled: :yaml)
end
def log_impersonation_event
......
......@@ -169,7 +169,7 @@ module Types
end
def hidden?
object.hidden? if Feature.enabled?(:ban_user_feature_flag)
object.hidden? if Feature.enabled?(:ban_user_feature_flag, default_enabled: :yaml)
end
def escalation_status
......
......@@ -63,7 +63,7 @@ module IssuesHelper
end
def issue_hidden?(issue)
Feature.enabled?(:ban_user_feature_flag) && issue.hidden?
Feature.enabled?(:ban_user_feature_flag, default_enabled: :yaml) && issue.hidden?
end
def hidden_issue_icon(issue)
......
......@@ -125,7 +125,7 @@ module UsersHelper
end
def ban_feature_available?
Feature.enabled?(:ban_user_feature_flag)
Feature.enabled?(:ban_user_feature_flag, default_enabled: :yaml)
end
def confirm_user_data(user)
......
......@@ -143,7 +143,7 @@ class Issue < ApplicationRecord
scope :confidential_only, -> { where(confidential: true) }
scope :without_hidden, -> {
if Feature.enabled?(:ban_user_feature_flag)
if Feature.enabled?(:ban_user_feature_flag, default_enabled: :yaml)
where('NOT EXISTS (?)', Users::BannedUser.select(1).where('issues.author_id = banned_users.user_id'))
else
all
......
......@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330667
milestone: '13.12'
type: development
group: group::access
default_enabled: false
default_enabled: true
......@@ -208,7 +208,13 @@ Users can also be activated using the [GitLab API](../../api/users.md#activate-u
## Ban and unban users
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/327353) in GitLab 14.2.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/327353) in GitLab 14.2 [with a flag](../../administration/feature_flags.md) named `ban_user_feature_flag`. Disabled by default.
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/330667) in GitLab 14.8.
FLAG:
On self-managed GitLab, by default this feature is available.
To hide the feature, ask an administrator to [disable the feature flag](../../administration/feature_flags.md) named `ban_user_feature_flag`.
On GitLab.com, this feature is available to GitLab.com administrators only.
GitLab administrators can ban and unban users. Banned users are blocked, and their issues are hidden.
The banned user's comments are still displayed. Hiding a banned user's comments is [tracked in this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/327356).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment