BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9e1db139
Commit
9e1db139
authored
Nov 03, 2015
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move level_name resolving to Gitlan::VisibilityLevel
parent
d2846293
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
base_service.rb
app/services/base_service.rb
+1
-4
visibility_level.rb
lib/gitlab/visibility_level.rb
+9
-0
No files found.
app/services/base_service.rb
View file @
9e1db139
...
@@ -39,10 +39,7 @@ class BaseService
...
@@ -39,10 +39,7 @@ class BaseService
def
deny_visibility_level
(
model
,
denied_visibility_level
=
nil
)
def
deny_visibility_level
(
model
,
denied_visibility_level
=
nil
)
denied_visibility_level
||=
model
.
visibility_level
denied_visibility_level
||=
model
.
visibility_level
level_name
=
'Unknown'
level_name
=
Gitlab
::
VisibilityLevel
.
level_name
(
denied_visibility_level
)
Gitlab
::
VisibilityLevel
.
options
.
each
do
|
name
,
level
|
level_name
=
name
if
level
==
denied_visibility_level
end
model
.
errors
.
add
(
model
.
errors
.
add
(
:visibility_level
,
:visibility_level
,
...
...
lib/gitlab/visibility_level.rb
View file @
9e1db139
...
@@ -51,6 +51,15 @@ module Gitlab
...
@@ -51,6 +51,15 @@ module Gitlab
def
allowed_fork_levels
(
origin_level
)
def
allowed_fork_levels
(
origin_level
)
[
PRIVATE
,
INTERNAL
,
PUBLIC
].
select
{
|
level
|
level
<=
origin_level
}
[
PRIVATE
,
INTERNAL
,
PUBLIC
].
select
{
|
level
|
level
<=
origin_level
}
end
end
def
level_name
(
level
)
level_name
=
'Unknown'
options
.
each
do
|
name
,
lvl
|
level_name
=
name
if
lvl
==
level
end
level_name
end
end
end
def
private?
def
private?
...
...
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