* [bug #56825, done, 0.3h] check priv before show api structs and release views.

This commit is contained in:
sunhao
2024-11-13 17:28:32 +08:00
committed by 丁永亮
parent 96db8da2c9
commit d32f43efc6
4 changed files with 26 additions and 18 deletions
+11 -9
View File
@@ -1316,16 +1316,18 @@ const customRenders =
'sidebar-before': function()
{
if(!isApiLib()) return;
const canViewStructs = docAppHasPriv('struct');
const canViewReleases = docAppHasPriv('releases');
if(!canViewStructs && !canViewReleases) return;
const isListMode = this.mode === 'list';
const lang = getDocAppLang();
const listType = this.signals.listType.value;
const items = [
{text: lang.struct, selected: listType === 'structs' && isListMode, icon: 'treemap muted', command: 'showStructs'},
{type: 'divider', className: 'my-1'},
{text: lang.releases, selected: listType === 'releases' && isListMode, icon: 'version muted', command: 'showReleases'},
{type: 'divider', className: 'my-1'},
{text: lang.module, icon: 'list muted', command: 'showModules'}
];
const lang = getDocAppLang();
const listType = this.signals.listType.value;
const items = [];
if(canViewStructs) items.push({text: lang.struct, selected: listType === 'structs' && isListMode, icon: 'treemap muted', command: 'showStructs'}, {type: 'divider', className: 'my-1'});
if(canViewReleases) items.push({text: lang.releases, selected: listType === 'releases' && isListMode, icon: 'version muted', command: 'showReleases'}, {type: 'divider', className: 'my-1'});
items.push({text: lang.module, icon: 'list muted', command: 'showModules'});
return {
component: 'tree',
className: 'p-2 pb-0 api-lib-menu',
+11 -9
View File
@@ -136,16 +136,18 @@ const customRenders =
'sidebar-before': function()
{
if(!this.libID) return;
const canViewStructs = docAppHasPriv('struct');
const canViewReleases = docAppHasPriv('releases');
if(!canViewStructs && !canViewReleases) return;
const isListMode = this.mode === 'list';
const lang = getDocAppLang();
const listType = this.signals.listType.value;
const items = [
{text: lang.struct, selected: listType === 'structs' && isListMode, icon: 'treemap muted', command: 'showStructs'},
{type: 'divider', className: 'my-1'},
{text: lang.releases, selected: listType === 'releases' && isListMode, icon: 'version muted', command: 'showReleases'},
{type: 'divider', className: 'my-1'},
{text: lang.module, icon: 'list muted', command: 'showModules'}
];
const lang = getDocAppLang();
const listType = this.signals.listType.value;
const items = [];
if(canViewStructs) items.push({text: lang.struct, selected: listType === 'structs' && isListMode, icon: 'treemap muted', command: 'showStructs'}, {type: 'divider', className: 'my-1'});
if(canViewReleases) items.push({text: lang.releases, selected: listType === 'releases' && isListMode, icon: 'version muted', command: 'showReleases'}, {type: 'divider', className: 'my-1'});
items.push({text: lang.module, icon: 'list muted', command: 'showModules'});
return {
component: 'tree',
className: 'p-2 pb-0 api-lib-menu',
+2
View File
@@ -26,6 +26,8 @@ $privs['addModule'] = hasPriv('doc', 'addCatalog');
$privs['deleteModule'] = hasPriv('doc', 'deleteCatalog');
$privs['editModule'] = hasPriv('doc', 'editCatalog');
$privs['sortModule'] = hasPriv('doc', 'sortCatalog');
$privs['releases'] = hasPriv('api', 'releases');
$privs['struct'] = hasPriv('api', 'struct');
docApp
(
+2
View File
@@ -55,6 +55,8 @@ $privs['createApi'] = hasPriv('api', 'create');
$privs['editApi'] = hasPriv('api', 'edit');
$privs['createStruct'] = hasPriv('api', 'createStruct');
$privs['createRelease']= hasPriv('api', 'createRelease');
$privs['releases'] = hasPriv('api', 'releases');
$privs['struct'] = hasPriv('api', 'struct');
$privs['createOffice'] = true;
$homeName = false;