Commit b426455d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'prat-scope-description' into 'master'

Project access token specific scope descriptions

See merge request gitlab-org/gitlab!31667
parents e61979bb ba62e826
# frozen_string_literal: true
module AccessTokensHelper
def scope_description(prefix)
prefix == :project_access_token ? [:doorkeeper, :project_access_token_scope_desc] : [:doorkeeper, :scope_desc]
end
end
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
%fieldset.form-group.form-check %fieldset.form-group.form-check
= check_box_tag "#{prefix}[scopes][]", scope, token.scopes.include?(scope), id: "#{prefix}_scopes_#{scope}", class: "form-check-input qa-#{scope}-radio" = check_box_tag "#{prefix}[scopes][]", scope, token.scopes.include?(scope), id: "#{prefix}_scopes_#{scope}", class: "form-check-input qa-#{scope}-radio"
= label_tag ("#{prefix}_scopes_#{scope}"), scope, class: 'label-bold form-check-label' = label_tag ("#{prefix}_scopes_#{scope}"), scope, class: 'label-bold form-check-label'
.text-secondary= t scope, scope: [:doorkeeper, :scope_desc] .text-secondary= t scope, scope: scope_description(prefix)
...@@ -88,6 +88,19 @@ en: ...@@ -88,6 +88,19 @@ en:
Grants read-only access to the user's profile data using OpenID Connect. Grants read-only access to the user's profile data using OpenID Connect.
email: email:
Grants read-only access to the user's primary email address using OpenID Connect. Grants read-only access to the user's primary email address using OpenID Connect.
project_access_token_scope_desc:
api:
Grants complete read/write access to the scoped project API.
read_api:
Grants read access to the scoped project API.
read_repository:
Allows read-only access (pull) to the repository.
write_repository:
Allows read-write access (pull, push) to the repository.
read_registry:
Allows read-access (pull) to container registry images if the project is private and authorization is required.
write_registry:
Allows write-access (push) to container registry.
flash: flash:
applications: applications:
create: create:
......
...@@ -47,7 +47,7 @@ the following table. ...@@ -47,7 +47,7 @@ the following table.
| Scope | Description | | Scope | Description |
| ------------------ | ----------- | | ------------------ | ----------- |
| `api` | Grants complete read/write access to scoped project API. | | `api` | Grants complete read/write access to the scoped project API. |
| `read_api` | Grants read access to the scoped project API. | | `read_api` | Grants read access to the scoped project API. |
| `read_registry` | Allows read-access (pull) to [container registry](../../packages/container_registry/index.md) images if a project is private and authorization is required. | | `read_registry` | Allows read-access (pull) to [container registry](../../packages/container_registry/index.md) images if a project is private and authorization is required. |
| `write_registry` | Allows write-access (push) to [container registry](../../packages/container_registry/index.md). | | `write_registry` | Allows write-access (push) to [container registry](../../packages/container_registry/index.md). |
......
# frozen_string_literal: true
require "spec_helper"
describe AccessTokensHelper do
describe "#scope_description" do
using RSpec::Parameterized::TableSyntax
where(:prefix, :description_location) do
:personal_access_token | [:doorkeeper, :scope_desc]
:project_access_token | [:doorkeeper, :project_access_token_scope_desc]
end
with_them do
it { expect(helper.scope_description(prefix)).to eq(description_location) }
end
end
end
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