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
Léo-Paul Géneau
gitlab-ce
Commits
d5f70604
Commit
d5f70604
authored
Mar 06, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `/take` to `/take_ownership`, expose `owner` in `v3`.
parent
01f99bd2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
doc/api/pipeline_triggers.md
doc/api/pipeline_triggers.md
+2
-2
lib/api/triggers.rb
lib/api/triggers.rb
+1
-1
lib/api/v3/entities.rb
lib/api/v3/entities.rb
+1
-0
spec/requests/api/triggers_spec.rb
spec/requests/api/triggers_spec.rb
+4
-4
No files found.
doc/api/pipeline_triggers.md
View file @
d5f70604
...
...
@@ -128,7 +128,7 @@ curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --form descrip
Update an owner of a project trigger.
```
POST /projects/:id/triggers/:trigger_id/take
POST /projects/:id/triggers/:trigger_id/take
_ownership
```
| Attribute | Type | required | Description |
...
...
@@ -136,7 +136,7 @@ POST /projects/:id/triggers/:trigger_id/take
|
`trigger_id`
| integer | yes | The trigger id |
```
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/triggers/10/take"
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/triggers/10/take
_ownership
"
```
```
json
...
...
lib/api/triggers.rb
View file @
d5f70604
...
...
@@ -114,7 +114,7 @@ module API
params
do
requires
:trigger_id
,
type:
Integer
,
desc:
'The trigger ID'
end
post
':id/triggers/:trigger_id/take'
do
post
':id/triggers/:trigger_id/take
_ownership
'
do
authenticate!
authorize!
:admin_build
,
user_project
...
...
lib/api/v3/entities.rb
View file @
d5f70604
...
...
@@ -189,6 +189,7 @@ module API
class
Trigger
<
Grape
::
Entity
expose
:token
,
:created_at
,
:updated_at
,
:deleted_at
,
:last_used
expose
:owner
,
using:
Entities
::
UserBasic
end
class
TriggerRequest
<
Grape
::
Entity
...
...
spec/requests/api/triggers_spec.rb
View file @
d5f70604
...
...
@@ -238,12 +238,12 @@ describe API::Triggers do
end
end
describe
'POST /projects/:id/triggers/:trigger_id/take'
do
describe
'POST /projects/:id/triggers/:trigger_id/take
_ownership
'
do
context
'authenticated user with valid permissions'
do
it
'updates owner'
do
expect
(
trigger
.
owner
).
to
be_nil
post
api
(
"/projects/
#{
project
.
id
}
/triggers/
#{
trigger
.
id
}
/take"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/triggers/
#{
trigger
.
id
}
/take
_ownership
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
include
(
'owner'
)
...
...
@@ -253,7 +253,7 @@ describe API::Triggers do
context
'authenticated user with invalid permissions'
do
it
'does not update owner'
do
post
api
(
"/projects/
#{
project
.
id
}
/triggers/
#{
trigger
.
id
}
/take"
,
user2
)
post
api
(
"/projects/
#{
project
.
id
}
/triggers/
#{
trigger
.
id
}
/take
_ownership
"
,
user2
)
expect
(
response
).
to
have_http_status
(
403
)
end
...
...
@@ -261,7 +261,7 @@ describe API::Triggers do
context
'unauthenticated user'
do
it
'does not update owner'
do
post
api
(
"/projects/
#{
project
.
id
}
/triggers/
#{
trigger
.
id
}
/take"
)
post
api
(
"/projects/
#{
project
.
id
}
/triggers/
#{
trigger
.
id
}
/take
_ownership
"
)
expect
(
response
).
to
have_http_status
(
401
)
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