* Finish task #60453.

This commit is contained in:
liyuchun
2022-07-12 06:30:13 +00:00
parent 625631c625
commit 6cef93edd9
19 changed files with 282 additions and 24 deletions
+32
View File
@@ -43,6 +43,11 @@ class gitea extends control
/* Admin user don't need bind. */
$giteaList = $this->gitea->getList($orderBy, $pager);
foreach($giteaList as $gitea)
{
$gitea->isBindUser = true;
if(!$this->app->user->admin and !isset($myGiteas[$gitea->id])) $gitea->isBindUser = false;
}
$this->view->title = $this->lang->gitea->common . $this->lang->colon . $this->lang->gitea->browse;
$this->view->giteaList = $giteaList;
@@ -164,4 +169,31 @@ class gitea extends control
return true;
}
/**
* Bind gitea user to zentao users.
*
* @param int $giteaID
* @access public
* @return void
*/
public function bindUser($giteaID)
{
$zentaoUsers = $this->dao->select('account,email,realname')->from(TABLE_USER)->fetchAll('account');
$userPairs = $this->loadModel('user')->getPairs('noclosed|noletter');
if($_POST)
{
$this->gitea->bindUser($giteaID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer));
}
$this->view->title = $this->lang->gitea->bindUser;
$this->view->userPairs = $userPairs;
$this->view->giteaUsers = $this->gitea->apiGetUsers($giteaID);
$this->view->bindedUsers = $this->gitea->getUserAccountIdPairs($giteaID);
$this->view->matchedResult = $this->gitea->getMatchedUsers($giteaID, $this->view->giteaUsers, $zentaoUsers);
$this->display();
}
}