* Adjust gitlab commit sync api.
This commit is contained in:
@@ -20,19 +20,21 @@ class gitlabWebhookEntry extends baseEntry
|
||||
*/
|
||||
public function post()
|
||||
{
|
||||
$repoID = $this->param('repoID');
|
||||
if(empty($repoID)) return;
|
||||
|
||||
$this->loadModel('repo');
|
||||
|
||||
$repo = $this->repo->getByID($repoID);
|
||||
if(empty($repo)) return;
|
||||
|
||||
$headers = getallheaders(); /* Fetch all HTTP request headers. */
|
||||
$event = isset($headers['X-Gitlab-Event']) ? $headers['X-Gitlab-Event'] : '';
|
||||
$token = isset($headers['X-Gitlab-Token']) ? $headers['X-Gitlab-Token'] : '';
|
||||
if(empty($event) || empty($token)) return;
|
||||
|
||||
$repoID = $this->param('repoID');
|
||||
if(empty($repoID)) return;
|
||||
|
||||
$this->app->user = new stdclass();
|
||||
$this->app->user->account = '';
|
||||
$this->app->user->admin = false;
|
||||
$repo = $this->loadModel('repo')->getByID($repoID);
|
||||
if(empty($repo)) return;
|
||||
|
||||
|
||||
$this->repo->handleWebhook($event, $this->requestBody, $repo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class gitlabModel extends model
|
||||
if(!$gitlab) return '';
|
||||
|
||||
$sudoParam = '';
|
||||
if($sudo == true and !$this->app->user->admin)
|
||||
if($sudo == true && !$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->loadModel('pipeline')->getOpenIdByAccount($gitlabID, 'gitlab', $this->app->user->account);
|
||||
if($openID) $sudoParam = "&sudo={$openID}";
|
||||
|
||||
Reference in New Issue
Block a user