Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Privacy
Imprint
Contact
Login methods
Sign in
Toggle navigation
Menu
Open sidebar
projects.thm.de
GitLab FOSS
Commits
ae1e8514
Commit
ae1e8514
authored
May 04, 2015
by
Daniel Gerhardt
Browse files
Prevent group names of length < 5 when updating settings
This restriction does not apply to admins.
parent
62ac42b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/groups_controller.rb
View file @
ae1e8514
...
@@ -24,7 +24,8 @@ class GroupsController < Groups::ApplicationController
...
@@ -24,7 +24,8 @@ class GroupsController < Groups::ApplicationController
before_action
:user_actions
,
only:
[
:show
]
before_action
:user_actions
,
only:
[
:show
]
before_filter
:validate_name
,
only: :create
before_filter
:validate_name
,
only:
[
:create
,
:update
]
skip_cross_project_access_check
:index
,
:new
,
:create
,
:edit
,
:update
,
skip_cross_project_access_check
:index
,
:new
,
:create
,
:edit
,
:update
,
:destroy
,
:projects
:destroy
,
:projects
...
@@ -196,10 +197,15 @@ def user_actions
...
@@ -196,10 +197,15 @@ def user_actions
end
end
def
validate_name
def
validate_name
@
group
=
Group
.
new
(
group_params
)
group
=
Group
.
new
(
group_params
)
unless
@
group
.
path
.
empty?
||
@
group
.
path
.
length
>
4
||
current_user
.
admin?
unless
group
.
path
.
empty?
||
group
.
path
.
length
>
4
||
current_user
.
admin?
flash
.
now
[
:alert
]
=
'Path must have at least a length of 5.'
flash
.
now
[
:alert
]
=
'Path must have at least a length of 5.'
render
action:
"new"
if
action_name
==
'update'
render
action:
'edit'
else
@group
=
group
render
action:
'new'
end
end
end
end
end
...
...
Write
Preview
Supports
Markdown
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