Authorization development guidelines

Authorization controls what users are allowed to do in GitLab. When implementing any feature that reads, creates, modifies, or deletes data, you must consider how access is controlled and enforced consistently across all entry points.

Reviews

Concepts

  • DeclarativePolicy framework: Introduction to DeclarativePolicy framework used for authorization.
  • Default roles: Overview of default roles, user types, and how abilities are assigned.
  • Custom roles: Guidance on how to work on custom role, how to introduce a new ability for custom roles, how to refactor permissions.
  • Roles and permissions matrix: The full reference of what each role can do across GitLab features.
  • Glossary: Definitions of key authentication and authorization terms used across GitLab.

Where to check permissions

Token permissions

Testing

  • Testing: Guidance for how to write specs for permission checks.