Add validation for permission name and file location
What does this MR do and why?
This MR adds validation for the permission name and definition file location. This is for the permission catalog that will be located in config/authz/permissions
This task is not enabled in CI pipelines. Permissions documentation will be updated when this validation is enforced in CI.
References
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
Besides the specs, you can run validation with bundle exec rake gitlab:permissions:validate
This will likely result in some definition file errors. To force errors that this validation will check apply the following patch and run the task.
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index 42227d387583..752814fe0297 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -387,6 +387,7 @@ class ProjectPolicy < BasePolicy
enable :read_note
enable :create_project
enable :create_issue
+ enable :create_issue_
enable :create_note
enable :upload_file
enable :read_cycle_analytics
diff --git a/config/authz/permissions/issue/create.yml b/config/authz/permissions/issue/create.yml
index 480973b97665..578adfd113f9 100644
--- a/config/authz/permissions/issue/create.yml
+++ b/config/authz/permissions/issue/create.yml
@@ -1,4 +1,4 @@
-name: create_issue
+name: create_issue_
description: Grants the ability to create issues
scopes:
- project
diff --git a/config/authz/permissions/issue/undefined.yml b/config/authz/permissions/issue/undefined.yml
new file mode 100644
index 000000000000..841f440c28ca
--- /dev/null
+++ b/config/authz/permissions/issue/undefined.yml
@@ -0,0 +1,5 @@
+name: undefined_issue
+description: unknown permission
+scopes:
+ - project
+feature_category: team_planning
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Ian Anderson