Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
541031a0
Commit
541031a0
authored
May 04, 2015
by
Daniel Gerhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent group names of length < 5 when updating settings
This restriction does not apply to admins.
parent
23b57fdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+10
-4
No files found.
app/controllers/groups_controller.rb
View file @
541031a0
...
...
@@ -18,7 +18,8 @@ class GroupsController < Groups::ApplicationController
before_action
:user_actions
,
only:
[
:show
,
:subgroups
]
before_filter
:validate_name
,
only: :create
before_filter
:validate_name
,
only:
[
:create
,
:update
]
skip_cross_project_access_check
:index
,
:new
,
:create
,
:edit
,
:update
,
:destroy
,
:projects
...
...
@@ -187,10 +188,15 @@ def user_actions
end
def
validate_name
@
group
=
Group
.
new
(
group_params
)
unless
@
group
.
path
.
empty?
||
@
group
.
path
.
length
>
4
||
current_user
.
admin?
group
=
Group
.
new
(
group_params
)
unless
group
.
path
.
empty?
||
group
.
path
.
length
>
4
||
current_user
.
admin?
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
...
...
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