* [task#149831] modify the judgment logic of ai priv.
This commit is contained in:
@@ -492,7 +492,7 @@ class ai extends control
|
||||
$promptID = $this->ai->createPrompt($prompt);
|
||||
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
$url = commonModel::hasPriv('ai', 'promptassignrole') ? $this->createLink('ai', 'promptassignrole', "prompt=$promptID") : $this->createLink('ai', 'promptview', "id=$promptID");
|
||||
$url = commonModel::hasPriv('ai', 'designPrompt') ? $this->createLink('ai', 'promptassignrole', "prompt=$promptID") : $this->createLink('ai', 'promptview', "id=$promptID");
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'load' => $url));
|
||||
}
|
||||
|
||||
@@ -553,6 +553,7 @@ class ai extends control
|
||||
*/
|
||||
public function promptAssignRole($promptID)
|
||||
{
|
||||
if(!common::hasPriv('ai', 'designPrompt')) $this->loadModel('common')->deny('ai', 'designPrompt', false);
|
||||
$prompt = $this->ai->getPromptByID($promptID);
|
||||
|
||||
if($_POST)
|
||||
@@ -597,6 +598,7 @@ class ai extends control
|
||||
*/
|
||||
public function promptSelectDataSource($promptID)
|
||||
{
|
||||
if(!common::hasPriv('ai', 'designPrompt')) $this->loadModel('common')->deny('ai', 'designPrompt', false);
|
||||
$prompt = $this->ai->getPromptByID($promptID);
|
||||
|
||||
if($_POST)
|
||||
@@ -635,6 +637,7 @@ class ai extends control
|
||||
*/
|
||||
public function promptSetPurpose($promptID)
|
||||
{
|
||||
if(!common::hasPriv('ai', 'designPrompt')) $this->loadModel('common')->deny('ai', 'designPrompt', false);
|
||||
$prompt = $this->ai->getPromptByID($promptID);
|
||||
|
||||
if($_POST)
|
||||
@@ -671,6 +674,7 @@ class ai extends control
|
||||
*/
|
||||
public function promptSetTargetForm($promptID)
|
||||
{
|
||||
if(!common::hasPriv('ai', 'designPrompt')) $this->loadModel('common')->deny('ai', 'designPrompt', false);
|
||||
$prompt = $this->ai->getPromptByID($promptID);
|
||||
|
||||
if($_POST)
|
||||
@@ -712,6 +716,7 @@ class ai extends control
|
||||
*/
|
||||
public function promptFinalize($promptID)
|
||||
{
|
||||
if(!common::hasPriv('ai', 'designPrompt')) $this->loadModel('common')->deny('ai', 'designPrompt', false);
|
||||
$prompt = $this->ai->getPromptByID($promptID);
|
||||
|
||||
if($_POST)
|
||||
@@ -823,6 +828,8 @@ class ai extends control
|
||||
*/
|
||||
public function promptAudit($promptId, $objectId, $exit = false)
|
||||
{
|
||||
if(!common::hasPriv('ai', 'designPrompt')) $this->loadModel('common')->deny('ai', 'designPrompt', false);
|
||||
|
||||
if(!empty($exit))
|
||||
{
|
||||
unset($_SESSION['auditPrompt']);
|
||||
|
||||
+3
-3
@@ -63,8 +63,8 @@ class aiModel extends model
|
||||
$executable = $this->isExecutable($object);
|
||||
$published = $object->status == 'active';
|
||||
|
||||
if($action == 'promptassignrole') return common::hasPriv('ai', 'promptassignrole') && !$published;
|
||||
if($action == 'promptaudit') return common::hasPriv('ai', 'promptaudit') && $executable && !$published;
|
||||
if($action == 'promptassignrole') return common::hasPriv('ai', 'designPrompt') && !$published;
|
||||
if($action == 'promptaudit') return common::hasPriv('ai', 'designPrompt') && $executable && !$published;
|
||||
if($action == 'promptedit') return common::hasPriv('ai', 'promptedit');
|
||||
if($action == 'promptpublish') return common::hasPriv('ai', 'promptpublish') && !$published && $executable;
|
||||
if($action == 'promptunpublish') return common::hasPriv('ai', 'promptunpublish') && $published && $executable;
|
||||
@@ -2607,7 +2607,7 @@ class aiModel extends model
|
||||
return $this->dao->select('*')->from(TABLE_AI_PROMPT)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('module')->eq($module)
|
||||
->beginIF(!commonModel::hasPriv('ai', 'promptaudit') || $this->config->edition == 'open')->andWhere('status')->eq('active')->fi() // Only show active prompts to non-auditors.
|
||||
->beginIF(!commonModel::hasPriv('ai', 'designPrompt') || $this->config->edition == 'open')->andWhere('status')->eq('active')->fi() // Only show active prompts to non-auditors.
|
||||
->orderBy('id_desc')
|
||||
->fetchAll('id', false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user