Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7267f57e
Commit
7267f57e
authored
Jun 24, 2020
by
Kyle Wiebers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'nelbacha-master-patch-50345' into 'master'"
This reverts merge request !33042
parent
496b8167
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
70 deletions
+2
-70
app/helpers/deploy_tokens_helper.rb
app/helpers/deploy_tokens_helper.rb
+2
-8
app/views/shared/deploy_tokens/_form.html.haml
app/views/shared/deploy_tokens/_form.html.haml
+0
-1
ee/changelogs/unreleased/nelbacha-master-patch-50345.yml
ee/changelogs/unreleased/nelbacha-master-patch-50345.yml
+0
-5
ee/spec/views/shared/deploy_tokens/_form.html.haml_spec.rb
ee/spec/views/shared/deploy_tokens/_form.html.haml_spec.rb
+0
-56
No files found.
app/helpers/deploy_tokens_helper.rb
View file @
7267f57e
...
@@ -7,14 +7,8 @@ module DeployTokensHelper
...
@@ -7,14 +7,8 @@ module DeployTokensHelper
Rails
.
env
.
test?
Rails
.
env
.
test?
end
end
def
container_registry_enabled?
(
sub
ject
)
def
container_registry_enabled?
(
pro
ject
)
Gitlab
.
config
.
registry
.
enabled
&&
Gitlab
.
config
.
registry
.
enabled
&&
can?
(
current_user
,
:read_container_image
,
subject
)
can?
(
current_user
,
:read_container_image
,
project
)
end
def
packages_registry_enabled?
(
subject
)
Gitlab
.
config
.
packages
.
enabled
&&
subject
.
feature_available?
(
:packages
)
&&
can?
(
current_user
,
:read_package
,
subject
)
end
end
end
end
app/views/shared/deploy_tokens/_form.html.haml
View file @
7267f57e
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
=
label_tag
(
"deploy_token_write_registry"
),
'write_registry'
,
class:
'label-bold form-check-label'
=
label_tag
(
"deploy_token_write_registry"
),
'write_registry'
,
class:
'label-bold form-check-label'
.text-secondary
=
s_
(
'DeployTokens|Allows write access to the registry images'
)
.text-secondary
=
s_
(
'DeployTokens|Allows write access to the registry images'
)
-
if
packages_registry_enabled?
(
group_or_project
)
%fieldset
.form-group.form-check
%fieldset
.form-group.form-check
=
f
.
check_box
:read_package_registry
,
class:
'form-check-input'
=
f
.
check_box
:read_package_registry
,
class:
'form-check-input'
=
label_tag
(
"deploy_token_read_package_registry"
),
'read_package_registry'
,
class:
'label-bold form-check-label'
=
label_tag
(
"deploy_token_read_package_registry"
),
'read_package_registry'
,
class:
'label-bold form-check-label'
...
...
ee/changelogs/unreleased/nelbacha-master-patch-50345.yml
deleted
100644 → 0
View file @
496b8167
---
title
:
Conditionally render the packages scopes in deploy token settings
merge_request
:
33042
author
:
type
:
fixed
ee/spec/views/shared/deploy_tokens/_form.html.haml_spec.rb
deleted
100644 → 0
View file @
496b8167
# frozen_string_literal: true
require
'spec_helper'
describe
'shared/deploy_tokens/_form.html.haml'
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:token
)
{
build
(
:deploy_token
)
}
let_it_be
(
:project
,
refind:
true
)
{
create
(
:project
,
:private
)
}
let_it_be
(
:group
,
refind:
true
)
{
create
(
:group
)
}
RSpec
.
shared_examples
"display deploy token settings"
do
|
role
,
type
,
can
|
let
(
:subject
)
{
type
==
:project
?
project
:
group
}
if
can
it
"renders the packages scopes for user role
#{
role
}
in
#{
type
}
"
do
render
'shared/deploy_tokens/form'
,
token:
token
,
group_or_project:
subject
expect
(
rendered
).
to
have_content
(
'Allows read access to the package registry'
)
end
else
it
"does not render the packages scopes for user role
#{
role
}
in
#{
type
}
"
do
render
'shared/deploy_tokens/form'
,
token:
token
,
group_or_project:
subject
expect
(
rendered
).
not_to
have_content
(
'Allows read access to the package registry'
)
end
end
end
where
(
:packages_enabled
,
:feature_enabled
,
:role
,
:subject
,
:can
)
do
true
|
true
|
:owner
|
:group
|
true
true
|
false
|
:owner
|
:group
|
false
false
|
true
|
:owner
|
:group
|
false
false
|
false
|
:owner
|
:group
|
false
true
|
true
|
:maintainer
|
:group
|
true
true
|
false
|
:maintainer
|
:group
|
false
false
|
true
|
:maintainer
|
:group
|
false
false
|
false
|
:maintainer
|
:group
|
false
true
|
true
|
:maintainer
|
:project
|
true
false
|
true
|
:maintainer
|
:project
|
false
true
|
false
|
:maintainer
|
:project
|
false
false
|
false
|
:maintainer
|
:project
|
false
end
with_them
do
before
do
subject
.
send
(
"add_
#{
role
}
"
,
user
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
stub_config
(
packages:
{
enabled:
packages_enabled
})
stub_licensed_features
(
packages:
feature_enabled
)
end
it_behaves_like
'display deploy token settings'
,
params
[
:role
],
params
[
:subject
],
params
[
:can
]
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment