This commit is contained in:
Yagami
2018-09-14 13:08:40 +08:00
9 changed files with 32 additions and 3 deletions
+3
View File
@@ -4,3 +4,6 @@ CREATE TABLE `zt_userview` (
`projects` text NOT NULL,
UNIQUE KEY `account` (`account`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `zt_entry` ADD `account` VARCHAR(30) NOT NULL DEFAULT '' AFTER `code`;
+1 -2
View File
@@ -1335,14 +1335,13 @@ class bugModel extends model
*/
public function getUserBugPairs($account, $appendProduct = true, $limit = 0)
{
$projects = $this->loadModel('project')->getPairs('empty|withdelete');
$bugs = array();
$stmt = $this->dao->select('t1.id, t1.title, t2.name as product')
->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')
->on('t1.product=t2.id')
->where('t1.assignedTo')->eq($account)
->andWhere('t1.project')->in(array_keys($projects))
->beginIF(!$this->app->user->admin)->andWhere('t1.project')->in($this->app->user->view->projects)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('id desc')
->beginIF($limit > 0)->limit($limit)->fi()
+10
View File
@@ -1601,9 +1601,19 @@ EOD;
$entry = $this->entry->getByCode($this->get->code);
if(!$entry) $this->response('EMPTY_ENTRY');
if(!$entry->key) $this->response('EMPTY_KEY');
if(empty($entry->account)) $this->response('ACCOUNT_UNBOUND');
if(!$this->checkIP($entry->ip)) $this->response('IP_DENIED');
if(!$this->checkEntryToken($entry->key)) $this->response('INVALID_TOKEN');
$this->loadModel('user');
$user = $this->dao->findByAccount($entry->account)->from(TABLE_USER)->fetch();
$user->rights = $this->user->authorize($user->account);
$user->groups = $this->user->getGroups($user->account);
$user->view = $this->user->grantUserView($user->account, $user->rights['acls']);
$user->admin = strpos($this->app->company->admins, ",{$user->account},") !== false;
$this->session->set('user', $user);
$this->app->user = $user;
$this->session->set('ENTRY_CODE', $this->get->code);
$this->session->set('VALID_ENTRY', md5(md5($this->get->code) . $this->server->remote_addr));
$this->loadModel('entry')->saveLog($entry->id, $this->server->request_uri);
+1
View File
@@ -14,4 +14,5 @@ $config->entry->errcode['EMPTY_KEY'] = 401;
$config->entry->errcode['INVALID_TOKEN'] = 401;
$config->entry->errcode['SESSION_VERIFY_FAILED'] = 401;
$config->entry->errcode['IP_DENIED'] = 403;
$config->entry->errcode['ACCOUNT_UNBOUND'] = 403;
$config->entry->errcode['EMPTY_ENTRY'] = 404;
+2
View File
@@ -53,6 +53,7 @@ class entry extends control
}
$this->view->title = $this->lang->entry->api . $this->lang->colon . $this->lang->entry->create;
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
$this->view->position[] = html::a(inlink('browse'), $this->lang->entry->api);
$this->view->position[] = html::a(inlink('browse'), $this->lang->entry->common);
$this->view->position[] = $this->lang->entry->create;
@@ -83,6 +84,7 @@ class entry extends control
$entry = $this->entry->getById($id);
$this->view->title = $this->lang->entry->edit . $this->lang->colon . $entry->name;
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
$this->view->position[] = html::a(inlink('browse'), $this->lang->entry->api);
$this->view->position[] = html::a(inlink('browse'), $this->lang->entry->common);
$this->view->position[] = $this->lang->entry->edit;
+2
View File
@@ -14,6 +14,7 @@ $lang->entry->createKey = 'Regenerate';
$lang->entry->id = 'ID';
$lang->entry->name = 'Name';
$lang->entry->account = 'Account';
$lang->entry->code = 'Code';
$lang->entry->key = 'Key';
$lang->entry->ip = 'IP';
@@ -41,4 +42,5 @@ $lang->entry->errmsg['EMPTY_KEY'] = 'Key of entry is missing.';
$lang->entry->errmsg['INVALID_TOKEN'] = 'Invalid token.';
$lang->entry->errmsg['SESSION_VERIFY_FAILED'] = 'Session verification failed.';
$lang->entry->errmsg['IP_DENIED'] = 'IP is denied.';
$lang->entry->errmsg['ACCOUNT_UNBOUND'] = 'Account unbound.';
$lang->entry->errmsg['EMPTY_ENTRY'] = 'Key of entry is missing.';
+2
View File
@@ -14,6 +14,7 @@ $lang->entry->createKey = '重新生成密钥';
$lang->entry->id = 'ID';
$lang->entry->name = '名称';
$lang->entry->account = '账号';
$lang->entry->code = '代号';
$lang->entry->key = '密钥';
$lang->entry->ip = 'IP';
@@ -41,4 +42,5 @@ $lang->entry->errmsg['EMPTY_KEY'] = '应用未设置密钥';
$lang->entry->errmsg['INVALID_TOKEN'] = '无效的token参数';
$lang->entry->errmsg['SESSION_VERIFY_FAILED'] = 'session验证失败';
$lang->entry->errmsg['IP_DENIED'] = '该IP被限制访问';
$lang->entry->errmsg['ACCOUNT_UNBOUND'] = '未绑定用户';
$lang->entry->errmsg['EMPTY_ENTRY'] = '应用不存在';
+5
View File
@@ -32,6 +32,11 @@
<td><?php echo html::input('code', '', "class='form-control' title='{$lang->entry->note->code}' placeholder='{$lang->entry->note->code}'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->entry->account;?></th>
<td><?php echo html::select("account", $users, '', "class='form-control chosen'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->entry->key;?></th>
<td><?php echo html::input('key', md5(rand()), "class='form-control' readonly='readonly'");?></td>
+6 -1
View File
@@ -31,6 +31,11 @@
<th><?php echo $lang->entry->code;?></th>
<td><?php echo html::input('code', $entry->code, "class='form-control' title='{$lang->entry->note->code}' placeholder='{$lang->entry->note->code}'");?></td>
</tr>
<tr>
<tr>
<th><?php echo $lang->entry->account;?></th>
<td><?php echo html::select("account", $users, $entry->account, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->entry->key;?></th>
<td><?php echo html::input('key', $entry->key, "class='form-control' readonly='readonly'");?></td>
@@ -53,7 +58,7 @@
<tr>
<th></th>
<td>
<?php echo html::submitButton();?>
<?php echo html::submitButton('', '', 'btn btn-wide btn-primary');?>
<?php echo html::a($config->entry->help, $lang->entry->help, '_blank', "class='help'");?>
</td>
</tr>