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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
31b0e149
Commit
31b0e149
authored
May 12, 2014
by
Alex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding project visibility to system hooks
parent
c355b9ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
22 deletions
+28
-22
app/services/system_hooks_service.rb
app/services/system_hooks_service.rb
+4
-2
doc/system_hooks/system_hooks.md
doc/system_hooks/system_hooks.md
+20
-16
spec/services/system_hooks_service_spec.rb
spec/services/system_hooks_service_spec.rb
+4
-4
No files found.
app/services/system_hooks_service.rb
View file @
31b0e149
...
@@ -31,7 +31,8 @@ class SystemHooksService
...
@@ -31,7 +31,8 @@ class SystemHooksService
path_with_namespace:
model
.
path_with_namespace
,
path_with_namespace:
model
.
path_with_namespace
,
project_id:
model
.
id
,
project_id:
model
.
id
,
owner_name:
owner
.
name
,
owner_name:
owner
.
name
,
owner_email:
owner
.
respond_to?
(
:email
)
?
owner
.
email
:
nil
owner_email:
owner
.
respond_to?
(
:email
)
?
owner
.
email
:
nil
,
project_visibility:
Project
.
visibility_levels
.
key
(
model
.
visibility_level_field
).
downcase
})
})
when
User
when
User
data
.
merge!
({
data
.
merge!
({
...
@@ -46,7 +47,8 @@ class SystemHooksService
...
@@ -46,7 +47,8 @@ class SystemHooksService
project_id:
model
.
project_id
,
project_id:
model
.
project_id
,
user_name:
model
.
user
.
name
,
user_name:
model
.
user
.
name
,
user_email:
model
.
user
.
email
,
user_email:
model
.
user
.
email
,
project_access:
model
.
human_access
project_access:
model
.
human_access
,
project_visibility:
Project
.
visibility_levels
.
key
(
model
.
project
.
visibility_level_field
).
downcase
})
})
end
end
end
end
...
...
doc/system_hooks/system_hooks.md
View file @
31b0e149
...
@@ -16,6 +16,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
...
@@ -16,6 +16,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
"path"
:
"stormcloud"
,
"path"
:
"stormcloud"
,
"path_with_namespace"
:
"jsmith/stormcloud"
,
"path_with_namespace"
:
"jsmith/stormcloud"
,
"project_id"
:
74
,
"project_id"
:
74
,
"project_visibility"
:
"private"
,
}
}
```
```
...
@@ -31,6 +32,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
...
@@ -31,6 +32,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
"path"
:
"underscore"
,
"path"
:
"underscore"
,
"path_with_namespace"
:
"jsmith/underscore"
,
"path_with_namespace"
:
"jsmith/underscore"
,
"project_id"
:
73
,
"project_id"
:
73
,
"project_visibility"
:
"internal"
,
}
}
```
```
...
@@ -38,14 +40,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
...
@@ -38,14 +40,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
```
json
```
json
{
{
"created_at"
:
"2012-07-21T07:30:56Z"
,
"created_at"
:
"2012-07-21T07:30:56Z"
,
"event_name"
:
"user_add_to_team"
,
"event_name"
:
"user_add_to_team"
,
"project_access"
:
"Master"
,
"project_access"
:
"Master"
,
"project_id"
:
74
,
"project_id"
:
74
,
"project_name"
:
"StoreCloud"
,
"project_name"
:
"StoreCloud"
,
"project_path"
:
"storecloud"
,
"project_path"
:
"storecloud"
,
"user_email"
:
"johnsmith@gmail.com"
,
"user_email"
:
"johnsmith@gmail.com"
,
"user_name"
:
"John Smith"
,
"user_name"
:
"John Smith"
,
"project_visibility"
:
"private"
,
}
}
```
```
...
@@ -53,14 +56,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
...
@@ -53,14 +56,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
```
json
```
json
{
{
"created_at"
:
"2012-07-21T07:30:56Z"
,
"created_at"
:
"2012-07-21T07:30:56Z"
,
"event_name"
:
"user_remove_from_team"
,
"event_name"
:
"user_remove_from_team"
,
"project_access"
:
"Master"
,
"project_access"
:
"Master"
,
"project_id"
:
74
,
"project_id"
:
74
,
"project_name"
:
"StoreCloud"
,
"project_name"
:
"StoreCloud"
,
"project_path"
:
"storecloud"
,
"project_path"
:
"storecloud"
,
"user_email"
:
"johnsmith@gmail.com"
,
"user_email"
:
"johnsmith@gmail.com"
,
"user_name"
:
"John Smith"
,
"user_name"
:
"John Smith"
,
"project_visibility"
:
"private"
,
}
}
```
```
...
...
spec/services/system_hooks_service_spec.rb
View file @
31b0e149
...
@@ -8,10 +8,10 @@ describe SystemHooksService do
...
@@ -8,10 +8,10 @@ describe SystemHooksService do
context
'event data'
do
context
'event data'
do
it
{
event_data
(
user
,
:create
).
should
include
(
:event_name
,
:name
,
:created_at
,
:email
,
:user_id
)
}
it
{
event_data
(
user
,
:create
).
should
include
(
:event_name
,
:name
,
:created_at
,
:email
,
:user_id
)
}
it
{
event_data
(
user
,
:destroy
).
should
include
(
:event_name
,
:name
,
:created_at
,
:email
,
:user_id
)
}
it
{
event_data
(
user
,
:destroy
).
should
include
(
:event_name
,
:name
,
:created_at
,
:email
,
:user_id
)
}
it
{
event_data
(
project
,
:create
).
should
include
(
:event_name
,
:name
,
:created_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
)
}
it
{
event_data
(
project
,
:create
).
should
include
(
:event_name
,
:name
,
:created_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
,
:project_visibility
)
}
it
{
event_data
(
project
,
:destroy
).
should
include
(
:event_name
,
:name
,
:created_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
)
}
it
{
event_data
(
project
,
:destroy
).
should
include
(
:event_name
,
:name
,
:created_at
,
:path
,
:project_id
,
:owner_name
,
:owner_email
,
:project_visibility
)
}
it
{
event_data
(
users_project
,
:create
).
should
include
(
:event_name
,
:created_at
,
:project_name
,
:project_path
,
:project_id
,
:user_name
,
:user_email
,
:project_access
)
}
it
{
event_data
(
users_project
,
:create
).
should
include
(
:event_name
,
:created_at
,
:project_name
,
:project_path
,
:project_id
,
:user_name
,
:user_email
,
:project_access
,
:project_visibility
)
}
it
{
event_data
(
users_project
,
:destroy
).
should
include
(
:event_name
,
:created_at
,
:project_name
,
:project_path
,
:project_id
,
:user_name
,
:user_email
,
:project_access
)
}
it
{
event_data
(
users_project
,
:destroy
).
should
include
(
:event_name
,
:created_at
,
:project_name
,
:project_path
,
:project_id
,
:user_name
,
:user_email
,
:project_access
,
:project_visibility
)
}
end
end
context
'event names'
do
context
'event names'
do
...
...
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