Commit 5dd7051f authored by Manoj M J's avatar Manoj M J

Perform validations on the parent of a namespace/group by default

This change validates the parent of a
namespace/group by default.

The validations are:

- A namesapce cannot have a parent
- A group can or cannot have a parent. If it has
a parent, it shoud be a group and not a namespace.

Changelog: added
parent fbce3dbb
......@@ -77,7 +77,7 @@ class Namespace < ApplicationRecord
validates :max_artifacts_size, numericality: { only_integer: true, greater_than: 0, allow_nil: true }
validate :validate_parent_type, if: -> { Feature.enabled?(:validate_namespace_parent_type) }
validate :validate_parent_type, if: -> { Feature.enabled?(:validate_namespace_parent_type, default_enabled: :yaml) }
validate :nesting_level_allowed
validate :changing_shared_runners_enabled_is_allowed
validate :changing_allow_descendants_override_disabled_shared_runners_is_allowed
......
......@@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/322101
milestone: '13.10'
type: development
group: group::access
default_enabled: false
default_enabled: true
......@@ -769,3 +769,22 @@ If a user sees a 404 when they would normally expect access, and the problem is
In viewing the log entries, compare the `remote.ip` with the list of
[allowed IPs](#restrict-group-access-by-ip-address) for the group.
### Validation errors on namespaces and groups
[GitLab 14.4 and later](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70365) performs
the following checks when creating or updating namespaces or groups:
- Namespaces must not have parents.
- Group parents must be groups and not namespaces.
You can disable the validation if GitLab shows the following errors:
- `A user namespace cannot have a parent`.
- `A group cannot have a user namespace as its parent`.
To disable the validation,
[disable the `validate_namespace_parent_type` flag](../../administration/feature_flags.md).
In the unlikely event that you had to disable this feature flag to prevent errors,
[contact Support](https://about.gitlab.com/support/) so that we can improve this validation.
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