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
29b40db5
Commit
29b40db5
authored
Aug 30, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More review comments
parent
eb05bdc6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
3 deletions
+13
-3
app/helpers/form_helper.rb
app/helpers/form_helper.rb
+0
-1
app/models/application_setting.rb
app/models/application_setting.rb
+2
-0
app/views/profiles/keys/_key.html.haml
app/views/profiles/keys/_key.html.haml
+2
-2
doc/security/img/ssh_keys_restrictions_settings.png
doc/security/img/ssh_keys_restrictions_settings.png
+0
-0
spec/models/application_setting_spec.rb
spec/models/application_setting_spec.rb
+9
-0
No files found.
app/helpers/form_helper.rb
View file @
29b40db5
...
@@ -3,7 +3,6 @@ module FormHelper
...
@@ -3,7 +3,6 @@ module FormHelper
return
unless
model
.
errors
.
any?
return
unless
model
.
errors
.
any?
pluralized
=
'error'
.
pluralize
(
model
.
errors
.
count
)
pluralized
=
'error'
.
pluralize
(
model
.
errors
.
count
)
headline
=
"The
#{
type
}
contains the following
#{
pluralized
}
:"
headline
=
"The
#{
type
}
contains the following
#{
pluralized
}
:"
content_tag
(
:div
,
class:
'alert alert-danger'
,
id:
'error_explanation'
)
do
content_tag
(
:div
,
class:
'alert alert-danger'
,
id:
'error_explanation'
)
do
...
...
app/models/application_setting.rb
View file @
29b40db5
...
@@ -155,6 +155,8 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -155,6 +155,8 @@ class ApplicationSetting < ActiveRecord::Base
validates
:"
#{
type
}
_key_restriction"
,
presence:
true
,
key_restriction:
{
type:
type
}
validates
:"
#{
type
}
_key_restriction"
,
presence:
true
,
key_restriction:
{
type:
type
}
end
end
validates
:allowed_key_types
,
presence:
true
validates_each
:restricted_visibility_levels
do
|
record
,
attr
,
value
|
validates_each
:restricted_visibility_levels
do
|
record
,
attr
,
value
|
value
&
.
each
do
|
level
|
value
&
.
each
do
|
level
|
unless
Gitlab
::
VisibilityLevel
.
options
.
value?
(
level
)
unless
Gitlab
::
VisibilityLevel
.
options
.
value?
(
level
)
...
...
app/views/profiles/keys/_key.html.haml
View file @
29b40db5
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
-
if
key
.
valid?
-
if
key
.
valid?
=
icon
'key'
,
class:
'settings-list-icon hidden-xs'
=
icon
'key'
,
class:
'settings-list-icon hidden-xs'
-
else
-
else
=
icon
'exclamation-triangle'
,
class:
'settings-list-icon hidden-xs'
,
=
icon
'exclamation-triangle'
,
class:
'settings-list-icon hidden-xs
has-tooltip
'
,
title:
'The key is disabled because it is invalid'
title:
key
.
errors
.
full_messages
.
join
(
', '
)
.key-list-item-info
.key-list-item-info
...
...
doc/security/img/ssh_keys_restrictions_settings.png
View replaced file @
eb05bdc6
View file @
29b40db5
13.4 KB
|
W:
|
H:
66.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
spec/models/application_setting_spec.rb
View file @
29b40db5
...
@@ -77,6 +77,15 @@ describe ApplicationSetting do
...
@@ -77,6 +77,15 @@ describe ApplicationSetting do
expect
(
described_class
::
SUPPORTED_KEY_TYPES
).
to
contain_exactly
(
:rsa
,
:dsa
,
:ecdsa
,
:ed25519
)
expect
(
described_class
::
SUPPORTED_KEY_TYPES
).
to
contain_exactly
(
:rsa
,
:dsa
,
:ecdsa
,
:ed25519
)
end
end
it
'does not allow all key types to be disabled'
do
described_class
::
SUPPORTED_KEY_TYPES
.
each
do
|
type
|
setting
[
"
#{
type
}
_key_restriction"
]
=
described_class
::
FORBIDDEN_KEY_VALUE
end
expect
(
setting
).
not_to
be_valid
expect
(
setting
.
errors
.
messages
).
to
have_key
(
:allowed_key_types
)
end
where
(
:type
)
do
where
(
:type
)
do
described_class
::
SUPPORTED_KEY_TYPES
described_class
::
SUPPORTED_KEY_TYPES
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