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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
2379c8be
Commit
2379c8be
authored
Dec 07, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inline Gitlab::Blacklist in NamespaceValidator
parent
175f482c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
38 deletions
+32
-38
app/validators/namespace_validator.rb
app/validators/namespace_validator.rb
+32
-4
lib/gitlab/blacklist.rb
lib/gitlab/blacklist.rb
+0
-34
No files found.
app/validators/namespace_validator.rb
View file @
2379c8be
...
...
@@ -2,21 +2,49 @@
#
# Custom validator for GitLab namespace values.
#
# Values are checked for formatting and exclusion from `Gitlab::Blacklist.path`.
# Values are checked for formatting and exclusion from a list of reserved path
# names.
class
NamespaceValidator
<
ActiveModel
::
EachValidator
RESERVED
=
%w(
admin
all
assets
ci
dashboard
files
groups
help
hooks
issues
merge_requests
notes
profile
projects
public
repository
s
search
services
snippets
teams
u
unsubscribes
users
)
.
freeze
def
validate_each
(
record
,
attribute
,
value
)
unless
value
=~
Gitlab
::
Regex
.
namespace_regex
record
.
errors
.
add
(
attribute
,
Gitlab
::
Regex
.
namespace_regex_message
)
end
if
blacklist
ed?
(
value
)
if
reserv
ed?
(
value
)
record
.
errors
.
add
(
attribute
,
"
#{
value
}
is a reserved name"
)
end
end
private
def
blacklist
ed?
(
value
)
Gitlab
::
Blacklist
.
path
.
include?
(
value
)
def
reserv
ed?
(
value
)
RESERVED
.
include?
(
value
)
end
end
lib/gitlab/blacklist.rb
deleted
100644 → 0
View file @
175f482c
module
Gitlab
module
Blacklist
extend
self
def
path
%w(
admin
dashboard
files
groups
help
profile
projects
search
public
assets
u
s
teams
merge_requests
issues
users
snippets
services
repository
hooks
notes
unsubscribes
all
ci
)
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