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
82ae973a
Commit
82ae973a
authored
Dec 30, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Describe for Roles
parent
64db5f80
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
75 additions
and
3 deletions
+75
-3
app/roles/account.rb
app/roles/account.rb
+6
-0
app/roles/authority.rb
app/roles/authority.rb
+6
-0
app/roles/git_host.rb
app/roles/git_host.rb
+6
-0
app/roles/issue_commonality.rb
app/roles/issue_commonality.rb
+5
-0
app/roles/namespaced_project.rb
app/roles/namespaced_project.rb
+9
-0
app/roles/note_event.rb
app/roles/note_event.rb
+6
-0
app/roles/push_event.rb
app/roles/push_event.rb
+8
-2
app/roles/push_observer.rb
app/roles/push_observer.rb
+6
-1
app/roles/repository.rb
app/roles/repository.rb
+7
-0
app/roles/team.rb
app/roles/team.rb
+9
-0
app/roles/votes.rb
app/roles/votes.rb
+7
-0
No files found.
app/roles/account.rb
View file @
82ae973a
# == Account role
#
# Describe behaviour of User in application
#
# Used by User
#
module
Account
module
Account
# Returns a string for use as a Gitolite user identifier
# Returns a string for use as a Gitolite user identifier
#
#
...
...
app/roles/authority.rb
View file @
82ae973a
# == Authority role
#
# Control access to project repository based on users role in team
#
# Used by Project
#
module
Authority
module
Authority
# Compatible with all access rights
# Compatible with all access rights
# Should be rewrited for new access rights
# Should be rewrited for new access rights
...
...
app/roles/git_host.rb
View file @
82ae973a
# == GitHost role
#
# Provide a shortcut to Gitlab::Gitolite instance
#
# Used by Project, UsersProject
#
module
GitHost
module
GitHost
def
git_host
def
git_host
Gitlab
::
Gitolite
.
new
Gitlab
::
Gitolite
.
new
...
...
app/roles/issue_commonality.rb
View file @
82ae973a
# == IssueCommonality role
#
# Contains common functionality shared between Issues and MergeRequests
# Contains common functionality shared between Issues and MergeRequests
#
# Used by Issue, MergeRequest
#
module
IssueCommonality
module
IssueCommonality
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
...
...
app/roles/namespaced_project.rb
View file @
82ae973a
# == NamespacedProject role
#
# Provides extra functionality for Project related to namespaces like:
# - transfer project between namespaces
# - name, path including namespece
# - project owner based on namespace
#
# Used by Project
#
module
NamespacedProject
module
NamespacedProject
def
transfer
(
new_namespace
)
def
transfer
(
new_namespace
)
Project
.
transaction
do
Project
.
transaction
do
...
...
app/roles/note_event.rb
View file @
82ae973a
# == NoteEvent role
#
# Extends Event model functionality by providing extra methods related to comment events
#
# Used by Event
#
module
NoteEvent
module
NoteEvent
def
note_commit_id
def
note_commit_id
target
.
commit_id
target
.
commit_id
...
...
app/roles/push_event.rb
View file @
82ae973a
# == PushEvent role
#
# Extends Event model functionality by providing extra methods related to push events
#
# Used by Event
#
module
PushEvent
module
PushEvent
def
valid_push?
def
valid_push?
data
[
:ref
]
data
[
:ref
]
...
@@ -58,7 +64,7 @@ module PushEvent
...
@@ -58,7 +64,7 @@ module PushEvent
@commits
||=
data
[
:commits
].
map
{
|
commit
|
project
.
commit
(
commit
[
:id
])
}.
reverse
@commits
||=
data
[
:commits
].
map
{
|
commit
|
project
.
commit
(
commit
[
:id
])
}.
reverse
end
end
def
commits_count
def
commits_count
data
[
:total_commits_count
]
||
commits
.
count
||
0
data
[
:total_commits_count
]
||
commits
.
count
||
0
end
end
...
@@ -88,7 +94,7 @@ module PushEvent
...
@@ -88,7 +94,7 @@ module PushEvent
nil
nil
end
end
def
push_with_commits?
def
push_with_commits?
md_ref?
&&
commits
.
any?
&&
parent_commit
&&
last_commit
md_ref?
&&
commits
.
any?
&&
parent_commit
&&
last_commit
rescue
Grit
::
NoSuchPathError
rescue
Grit
::
NoSuchPathError
false
false
...
...
app/roles/push_observer.rb
View file @
82ae973a
#
Includes methods for handling Git Push events
#
== PushObserver role
#
#
# Includes methods to be triggered on push to project repository.
#
#
# Used by Project
# Triggered by PostReceive job
# Triggered by PostReceive job
#
module
PushObserver
module
PushObserver
# This method will be called after each post receive and only if the provided
# This method will be called after each post receive and only if the provided
# user is present in GitLab.
# user is present in GitLab.
...
...
app/roles/repository.rb
View file @
82ae973a
# == Repository role
#
# Provides access to git repository resources like commits, branches etc..
# Allows you to manage repository via gitolite interface(git_host)
#
# Used by Project
#
module
Repository
module
Repository
include
GitHost
include
GitHost
...
...
app/roles/team.rb
View file @
82ae973a
# == Team role
#
# Provides functionality to manage project team
# - add user/users to project
# - update existing membership
# - remove users from project team
#
# Used by Project
#
module
Team
module
Team
def
team_member_by_name_or_email
(
name
=
nil
,
email
=
nil
)
def
team_member_by_name_or_email
(
name
=
nil
,
email
=
nil
)
user
=
users
.
where
(
"name like ? or email like ?"
,
name
,
email
).
first
user
=
users
.
where
(
"name like ? or email like ?"
,
name
,
email
).
first
...
...
app/roles/votes.rb
View file @
82ae973a
# == Votes role
#
# Provides functionality to upvote/downvote entity
# based on +1 and -1 notes
#
# Used for Issue and Merge Request
#
module
Votes
module
Votes
# Return the number of +1 comments (upvotes)
# Return the number of +1 comments (upvotes)
def
upvotes
def
upvotes
...
...
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