@@ -152,7 +152,8 @@ public function uuidGet($args)
152
152
153
153
/**
154
154
* Get a resource by its UUID
155
- * @params uuid Universal identifier for the resource
155
+ * @param uuid Universal identifier for the resource
156
+ * @param folder (Optional) If set, will return the folder instead of the community record
156
157
* @return The resource's dao
157
158
*/
158
159
function resourceGet ($ args )
@@ -168,6 +169,11 @@ function resourceGet($args)
168
169
{
169
170
throw new Exception ('No resource for the given UUID. ' , MIDAS_INVALID_PARAMETER );
170
171
}
172
+
173
+ if ($ resource ->resourceType == MIDAS_RESOURCE_COMMUNITY && array_key_exists ('folder ' , $ args ))
174
+ {
175
+ return array ('type ' => MIDAS_RESOURCE_FOLDER , 'id ' => $ resource ->getFolderId ());
176
+ }
171
177
return array ('type ' => $ resource ->resourceType , 'id ' => $ resource ->getKey ());
172
178
}
173
179
@@ -645,20 +651,22 @@ function folderCreate($args)
645
651
{
646
652
throw new Exception ('Parent doesn \'t exist ' , MIDAS_INVALID_PARAMETER );
647
653
}
648
- $ new_folder = $ folderModel ->createFolder ($ name , $ description , $ folder );
654
+ $ new_folder = $ folderModel ->createFolder ($ name , $ description , $ folder, $ uuid );
649
655
if ($ new_folder === false )
650
656
{
651
657
throw new Exception ('Request failed ' , MIDAS_INTERNAL_ERROR );
652
658
}
653
659
$ policyGroup = $ folder ->getFolderpolicygroup ();
654
660
$ policyUser = $ folder ->getFolderpolicyuser ();
661
+ $ folderpolicygroupModel = $ modelLoader ->loadModel ('Folderpolicygroup ' );
662
+ $ folderpolicyuserModel = $ modelLoader ->loadModel ('Folderpolicygroup ' );
655
663
foreach ($ policyGroup as $ policy )
656
664
{
657
- $ folderModelpolicygroup ->createPolicy ($ policy ->getGroup (), $ new_folder , $ policy ->getPolicy ());
665
+ $ folderpolicygroupModel ->createPolicy ($ policy ->getGroup (), $ new_folder , $ policy ->getPolicy ());
658
666
}
659
667
foreach ($ policyUser as $ policy )
660
668
{
661
- $ folderModelpolicyuser ->createPolicy ($ policy ->getUser (), $ new_folder , $ policy ->getPolicy ());
669
+ $ folderpolicyuserModel ->createPolicy ($ policy ->getUser (), $ new_folder , $ policy ->getPolicy ());
662
670
}
663
671
664
672
return $ new_folder ->toArray ();
0 commit comments