* Finish task #54329.

This commit is contained in:
tianshujie
2022-05-19 09:43:34 +08:00
parent d79a01aecb
commit db940f77fd
4 changed files with 32 additions and 15 deletions

2
db/update17.0.beta1.sql Normal file
View File

@@ -0,0 +1,2 @@
insert into zt_config(vision, owner, module, `key`, value) select 'rnd', 'system', 'story', 'forceReviewUsers', `value` from zt_config where vision='rnd' and owner='system' and module='story' and `key`='forceReview';
insert into zt_config(vision, owner, module, `key`, value) select 'lite', 'system', 'story', 'forceReviewUsers', `value` from zt_config where vision='lite' and owner='system' and module='story' and `key`='forceReview';

View File

@@ -42,7 +42,7 @@ EOT;
.reviewBox > td {width: 500px !important;}
.checkbox-primary {margin-bottom: 0px; width: 82px !important;}
.storyReviewTip {padding-left: 95px;}
<?php if($app->getClientLang() != 'zh-cn' and $app->getClientLang() !== 'zh-tw'):?>
<?php if($app->getClientLang() != 'zh-cn' and $app->getClientLang() != 'zh-tw'):?>
.reviewBox > th {width: 160px !important;}
.storyReviewTip {padding-left: 160px;}
<?php endif;?>
@@ -107,7 +107,7 @@ EOT;
</tr>
<?php if($module == 'story'):?>
<tr>
<?php $space = ($app->getClientLang() != 'zh-cn' and $app->getClientLang() !== 'zh-tw') ? ' ': '';?>
<?php $space = ($app->getClientLang() != 'zh-cn' and $app->getClientLang() != 'zh-tw') ? ' ': '';?>
<td colspan='3'><div class='storyReviewTip'><?php echo sprintf($lang->custom->notice->forceReview, $lang->$module->common) . $lang->custom->notice->storyReviewTip;?></td>
</tr>
<tr id='userBox'>

View File

@@ -4323,7 +4323,7 @@ class storyModel extends model
if(isset($this->config->story->forceReviewAll) and $this->config->story->forceReviewAll) return true;
$forceUsers = '';
if(!empty($this->config->story->forceReviewUsers)) $forceUsers .= $this->config->story->forceReviewUsers;
if(!empty($this->config->story->forceReviewUsers)) $forceUsers = $this->config->story->forceReviewUsers;
if(!empty($this->config->story->forceReviewRoles) or !empty($this->config->story->forceReviewDepts))
{

View File

@@ -2774,25 +2774,40 @@ class userModel extends model
*/
public function getCanCreateStoryUsers()
{
$users = $this->getPairs('noclosed|nodeleted');
$groups = $this->dao->select('*')->from(TABLE_USERGROUP)
$users = $this->getPairs('noclosed|nodeleted');
$groupList = $this->dao->select('*')->from(TABLE_USERGROUP)
->where('account')->in(array_keys($users))
->fetchGroup('account', 'group');
$hasPrivGroups = $this->dao->select('*')->from(TABLE_GROUPPRIV)
->where('module')->eq('story')
->andWhere('(method')->eq('create')
->orWhere('method')->eq('batchCreate')
->markRight(1)
->fetchAll('group');
foreach($users as $account => $user)
{
if(empty($user) or strpos($this->app->company->admins, ",{$account},") !== false or !isset($groups[$account])) continue;
if(empty($user) or strpos($this->app->company->admins, ",{$account},") !== false) continue;
$group = $groups[$account];
$priv = $this->dao->select('*')->from(TABLE_GROUPPRIV)
->where('`group`')->in(array_keys($group))
->andWhere('module')->eq('story')
->andWhere('(method')->eq('create')
->orWhere('method')->eq('batchCreate')
->markRight(1)
->fetch();
if(!isset($groupList[$account]))
{
unset($users[$account]);
continue;
}
if(empty($priv)) unset($users[$account]);
$groups = $groupList[$account];
$hasPriv = false;
foreach($groups as $groupID => $group)
{
if(isset($hasPrivGroups[$groupID]))
{
$hasPriv = true;
break;
}
}
if(!$hasPriv) unset($users[$account]);
}
return $users;