* Finish task #48099,48097.
This commit is contained in:
+22
-24
@@ -861,7 +861,6 @@ class gitlab extends control
|
||||
*/
|
||||
public function browseBranchPriv($gitlabID, $projectID, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
|
||||
{
|
||||
$openID = 0;
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
|
||||
if(!$this->app->user->admin)
|
||||
@@ -903,15 +902,14 @@ class gitlab extends control
|
||||
*/
|
||||
public function createBranchPriv($gitlabID, $projectID, $branch = '')
|
||||
{
|
||||
$openID = 0;
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account);
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->app->user->admin and (!isset($project->owner) or $project->owner->id != $openID)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the branch name contains '-'.*/
|
||||
if($branch) $branch = str_replace('*', '-', $branch);
|
||||
@@ -985,15 +983,14 @@ class gitlab extends control
|
||||
*/
|
||||
public function deleteBranchPriv($gitlabID, $projectID, $branch, $confirm = 'no')
|
||||
{
|
||||
$openID = 0;
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account);
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->app->user->admin and (!isset($project->owner) or $project->owner->id != $openID)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
if($confirm != 'yes')
|
||||
{
|
||||
@@ -1029,10 +1026,14 @@ class gitlab extends control
|
||||
*/
|
||||
public function browseTag($gitlabID, $projectID, $orderBy = 'updated_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account);
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
|
||||
if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
$this->session->set('gitlabTagList', $this->app->getURI(true));
|
||||
@@ -1061,7 +1062,7 @@ class gitlab extends control
|
||||
$this->view->gitlabID = $gitlabID;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->keyword = $keyword;
|
||||
$this->view->project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
$this->view->project = $project;
|
||||
$this->view->gitlabTagList = $tagList;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
@@ -1081,14 +1082,14 @@ class gitlab extends control
|
||||
*/
|
||||
public function browseTagPriv($gitlabID, $projectID, $orderBy = 'name_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$openID = 0;
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account);
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
if(!isset($project->owner) or $project->owner->id != $openID) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
|
||||
if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
$this->session->set('gitlabTagPrivList', $this->app->getURI(true));
|
||||
@@ -1157,15 +1158,14 @@ class gitlab extends control
|
||||
*/
|
||||
public function createTagPriv($gitlabID, $projectID)
|
||||
{
|
||||
$openID = 0;
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account);
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->app->user->admin and (!isset($project->owner) or $project->owner->id != $openID)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
@@ -1203,15 +1203,14 @@ class gitlab extends control
|
||||
*/
|
||||
public function editTagPriv($gitlabID, $projectID, $tag = '')
|
||||
{
|
||||
$openID = 0;
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account);
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->app->user->admin and (!isset($project->owner) or $project->owner->id != $openID)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tag = str_replace('*', '-', $tag);
|
||||
@@ -1246,15 +1245,14 @@ class gitlab extends control
|
||||
*/
|
||||
public function deleteTagPriv($gitlabID, $projectID, $tag)
|
||||
{
|
||||
$openID = 0;
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account);
|
||||
if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->app->user->admin and (!isset($project->owner) or $project->owner->id != $openID)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
|
||||
if(!$this->gitlab->checkUserAccess($gitlabID, $openID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse')));
|
||||
}
|
||||
|
||||
/* Fix error when request type is PATH_INFO and the tag name contains '-'.*/
|
||||
$tag = str_replace('*', '-', $tag);
|
||||
|
||||
Reference in New Issue
Block a user