* [task#137612,doing,4h] Add the acl for doc template.

This commit is contained in:
xieqiyu
2025-02-19 16:11:14 +08:00
committed by 代婷婷
parent ff9bc1d7ed
commit c1c1e24be4
7 changed files with 61 additions and 3 deletions
+1
View File
@@ -504,6 +504,7 @@ class doc extends control
$modules = $this->doc->getTemplateModules();
$modules = array_column($modules, 'fullName', 'id');
$templateList = $this->doc->getDocTemplateList(0, $type, $orderBy, $pager);
$templateList = $this->doc->filterPrivDocs($templateList, 'template');
foreach($templateList as $template)
{
$template->moduleName = zget($modules, $template->module);
+3
View File
@@ -387,6 +387,9 @@ $lang->doc->statusList['draft'] = "Draft";
$lang->doc->aclList['open'] = "Public (Access with library permissions)";
$lang->doc->aclList['private'] = "Private (Only creators and whitelist users can access)";
$lang->doc->aclListA['open'] = "Public (Everyone can access it, with permission to edit document templates for access and maintenance.)";
$lang->doc->aclListA['private'] = "Private (Only creators and whitelist users can access it, with permission to edit document templates for access and management.)";
$lang->doc->selectSpace = 'Select Space';
$lang->doc->space = 'Space';
$lang->doc->spaceList['mine'] = 'My Space';
+3
View File
@@ -388,6 +388,9 @@ $lang->doc->statusList['draft'] = "Draft";
$lang->doc->aclList['open'] = "Public (Access with library permissions)";
$lang->doc->aclList['private'] = "Private (Only creators and whitelist users can access)";
$lang->doc->aclListA['open'] = "Public (Everyone can access it, with permission to edit document templates for access and maintenance)";
$lang->doc->aclListA['private'] = "Private (Only creators and whitelist users can access it, with permission to edit document templates for access and management)";
$lang->doc->selectSpace = 'Select Space';
$lang->doc->space = 'Space';
$lang->doc->spaceList['mine'] = 'My Space';
+3
View File
@@ -387,6 +387,9 @@ $lang->doc->statusList['draft'] = "Draft";
$lang->doc->aclList['open'] = "Public (Access with library permissions)";
$lang->doc->aclList['private'] = "Private (Only creators and whitelist users can access)";
$lang->doc->aclListA['open'] = "Public (Everyone can access it, with permission to edit document templates for access and maintenance)";
$lang->doc->aclListA['private'] = "Private (Only creators and whitelist users can access it, with permission to edit document templates for access and management)";
$lang->doc->selectSpace = 'Select Space';
$lang->doc->space = 'Space';
$lang->doc->spaceList['mine'] = 'My Space';
+3
View File
@@ -388,6 +388,9 @@ $lang->doc->statusList['draft'] = "草稿";
$lang->doc->aclList['open'] = "公开(有所属库权限即可访问)";
$lang->doc->aclList['private'] = "私有(仅创建者和白名单用户可访问)";
$lang->doc->aclListA['open'] = "公开(所有人均可访问,有编辑文档模板权限可访问并维护)";
$lang->doc->aclListA['private'] = "私有(仅创建者和白名单用户可访问,有编辑文档模板权限可访问并管理)";
$lang->doc->selectSpace = '选择空间';
$lang->doc->space = '所属空间';
$lang->doc->spaceList['mine'] = '我的空间';
+4 -3
View File
@@ -657,7 +657,7 @@ class docModel extends model
*/
public function getDocTemplateList(int $libID = 0, string $type = 'all', string $orderBy = 'id_desc', object $pager = null): array
{
return $this->dao->select('*')->from(TABLE_DOC)
return $this->dao->select('*,users')->from(TABLE_DOC)
->where('deleted')->eq('0')
->andWhere('templateType')->ne('')
->beginIF($libID)->andWhere('lib')->eq($libID)->fi()
@@ -4101,7 +4101,8 @@ class docModel extends model
foreach($this->lang->docTemplate->scopes as $scopeID => $scopeName)
{
$scopeTemplates[$scopeID] = $this->getHotTemplates($scopeID, 5);
$templates = $this->getHotTemplates($scopeID, 5);
$scopeTemplates[$scopeID] = $this->filterPrivDocs($templates, 'template');;
}
return $scopeTemplates;
@@ -4109,7 +4110,7 @@ class docModel extends model
public function getHotTemplates($scopeID = 0, $limit = 0)
{
return $this->dao->select('*, CASE WHEN addedDate > editedDate THEN addedDate ELSE editedDate END as hotDate')->from(TABLE_DOC)
return $this->dao->select('*, users, CASE WHEN addedDate > editedDate THEN addedDate ELSE editedDate END as hotDate')->from(TABLE_DOC)
->where('templateType')->ne('')
->andWhere('deleted')->eq('0')
->andWhere('status')->eq('normal')
@@ -43,5 +43,49 @@ formPanel
(
set::label($lang->docTemplate->desc),
textarea(set::name('desc'), set::value($docID ? $doc->templateDesc : ''), set::rows(3))
),
$isDraft ? null : formGroup
(
set::label($lang->doclib->control),
radioList
(
setClass($objectType == 'mine' ? 'pointer-events-none' : ''),
set::name('acl'),
set::items($lang->doc->aclListA),
set::value(isset($doc) ? $doc->acl : 'open'),
on::change('toggleWhiteList')
)
),
$isDraft ? null : formGroup
(
setID('whiteListBox'),
setClass((isset($doc) && $libID == $doc->lib && $objectType != 'mine' && $doc->acl == 'private') ? '' : 'hidden'),
set::label($lang->doc->whiteList),
div
(
setClass('w-full check-list'),
inputGroup
(
setClass('w-full'),
$lang->doc->groups,
picker
(
set::name('groups[]'),
set::items($groups),
set::value(isset($doc) ? $doc->groups : null),
set::multiple(true)
)
),
div
(
setClass('w-full'),
userPicker
(
set::label($lang->doc->users),
set::items($users),
set::value(isset($doc) ? $doc->users : null)
)
)
)
)
);