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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
35b719f6
Commit
35b719f6
authored
Apr 03, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use delegation in ProtectedRef concern
parent
04a50bd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
12 deletions
+2
-12
app/models/concerns/protected_ref.rb
app/models/concerns/protected_ref.rb
+2
-12
No files found.
app/models/concerns/protected_ref.rb
View file @
35b719f6
...
@@ -6,6 +6,8 @@ module ProtectedRef
...
@@ -6,6 +6,8 @@ module ProtectedRef
validates
:name
,
presence:
true
validates
:name
,
presence:
true
validates
:project
,
presence:
true
validates
:project
,
presence:
true
delegate
:matching
,
:matches?
,
:wildcard?
,
to: :ref_matcher
def
self
.
matching_refs_accesible_to
(
ref
,
user
,
action: :push
)
def
self
.
matching_refs_accesible_to
(
ref
,
user
,
action: :push
)
access_levels_for_ref
(
ref
,
action
).
any?
do
|
access_level
|
access_levels_for_ref
(
ref
,
action
).
any?
do
|
access_level
|
access_level
.
check_access
(
user
)
access_level
.
check_access
(
user
)
...
@@ -27,18 +29,6 @@ module ProtectedRef
...
@@ -27,18 +29,6 @@ module ProtectedRef
project
.
commit
(
self
.
name
)
project
.
commit
(
self
.
name
)
end
end
def
matching
(
refs
)
ref_matcher
.
matching
(
refs
)
end
def
matches?
(
refs
)
ref_matcher
.
matches?
(
refs
)
end
def
wildcard?
ref_matcher
.
wildcard?
end
private
private
def
ref_matcher
def
ref_matcher
...
...
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