Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Privacy
Imprint
Contact
Login methods
Sign in
Toggle navigation
Menu
Open sidebar
projects.thm.de
GitLab
Commits
4e1f1241
Commit
4e1f1241
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
20df1b35
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/groups_controller.rb
View file @
4e1f1241
...
...
@@ -16,7 +16,7 @@ class GroupsController < Groups::ApplicationController
before_action
:group_projects
,
only:
[
:show
,
:projects
,
:activity
,
:issues
,
:merge_requests
]
before_action
:event_filter
,
only:
[
:activity
]
before_filter
:validate_name
,
only: :create
before_filter
:validate_name
,
only:
[
:create
,
:update
]
layout
:determine_layout
...
...
@@ -143,10 +143,15 @@ def load_events
end
def
validate_name
@
group
=
Group
.
new
(
group_params
)
unless
@
group
.
path
.
empty?
||
@
group
.
path
.
length
>
4
||
current_user
.
is_admin?
group
=
Group
.
new
(
group_params
)
unless
group
.
path
.
empty?
||
group
.
path
.
length
>
4
||
current_user
.
is_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
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