diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-02-08 21:13:59 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-02-08 21:13:59 -0500 |
commit | 6f94ce6af3072543ee62d64016931ed424f800a7 (patch) | |
tree | 348d250d786dba40c14828cef3fb347116a0fa1a /app/Controller | |
parent | 02f7c8d33d60b41f5c2a5335f9f6ee56f236a7fe (diff) |
Add Bitbucket webhook
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Webhook.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/Controller/Webhook.php b/app/Controller/Webhook.php index 1ae3b0a4..ef79379f 100644 --- a/app/Controller/Webhook.php +++ b/app/Controller/Webhook.php @@ -82,4 +82,22 @@ class Webhook extends Base echo $result ? 'PARSED' : 'IGNORED'; } + + /** + * Handle Bitbucket webhooks + * + * @access public + */ + public function bitbucket() + { + if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) { + $this->response->text('Not Authorized', 401); + } + + $this->bitbucketWebhook->setProjectId($this->request->getIntegerParam('project_id')); + + $result = $this->bitbucketWebhook->parsePayload(json_decode(@$_POST['payload'], true)); + + echo $result ? 'PARSED' : 'IGNORED'; + } } |