* check for priv prior to executing and auditing prompts.

This commit is contained in:
liwenrui
2023-08-02 10:41:54 +08:00
parent dca806de33
commit ffed8a893f
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -1112,7 +1112,8 @@ class aiModel extends model
return $this->dao->select('*')->from(TABLE_PROMPT)
->where('deleted')->eq(0)
->andWhere('module')->eq($module)
->andWhere('status', true)->eq('active')->orWhere('createdBy')->eq($this->app->user->account)->markRight(1)
->beginIF(!common::hasPriv('ai', 'promptaudit'))->andWhere('status')->eq('active')->fi() // Only show active prompts to non-auditors.
->beginIF(common::hasPriv('ai', 'promptaudit'))->andWhere('status', true)->eq('active')->orWhere('createdBy')->eq($this->app->user->account)->markRight(1)->fi()
->orderBy('id_desc')
->fetchAll();
}
+2 -1
View File
@@ -13,6 +13,7 @@
* @link https://www.zentao.net
*/
?>
<?php if(commonModel::hasPriv('ai', 'executePrompt')):?>
<?php
$this->app->loadConfig('ai');
$module = $this->app->getModuleName();
@@ -70,4 +71,4 @@
});
</script>
<?php endif; endif;?>
<?php endif; endif; endif;?>