Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit e9fb5a0

Browse files
committed
ENH: refs #0436. Item creator (via web api) should get admin policy on the item
1 parent 2649886 commit e9fb5a0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/api/controllers/components/ApiComponent.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,11 +933,17 @@ function itemCreate($args)
933933
{
934934
throw new Exception('Parent folder doesn\'t exist', MIDAS_INVALID_PARAMETER);
935935
}
936+
if(!$folderModel->policyCheck($folder, $userDao, MIDAS_POLICY_WRITE))
937+
{
938+
throw new Exception('Invalid permissions on parent folder', MIDAS_INVALID_POLICY);
939+
}
936940
$item = $itemModel->createItem($name, $description, $folder, $uuid);
937941
if($item === false)
938942
{
939943
throw new Exception('Create new item failed', MIDAS_INTERNAL_ERROR);
940944
}
945+
$itempolicyuserModel = $modelLoader->loadModel('Itempolicyuser');
946+
$itempolicyuserModel->createPolicy($userDao, $item, MIDAS_POLICY_ADMIN);
941947

942948
return $item->toArray();
943949
}

0 commit comments

Comments
 (0)