This repository was archived by the owner on Sep 10, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
modules/api/controllers/components Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -488,6 +488,41 @@ function communityGet($args)
488
488
return $ community ->toArray ();
489
489
}
490
490
491
+ /**
492
+ * Get the immediate children of a community (non-recursive)
493
+ * @param token (Optional) Authentication token
494
+ * @param id The id of the community
495
+ * @return The folders in the community
496
+ */
497
+ function communityChildren ($ args )
498
+ {
499
+ $ this ->_validateParams ($ args , array ('id ' ));
500
+
501
+ $ id = $ args ['id ' ];
502
+
503
+ $ modelLoader = new MIDAS_ModelLoader ();
504
+ $ communityModel = $ modelLoader ->loadModel ('Community ' );
505
+ $ folderModel = $ modelLoader ->loadModel ('Folder ' );
506
+ $ community = $ communityModel ->load ($ id );
507
+ if (!$ community )
508
+ {
509
+ throw new Exception ('Invalid community id ' , MIDAS_INVALID_PARAMETER );
510
+ }
511
+ $ folder = $ folderModel ->load ($ community ->getFolderId ());
512
+
513
+ $ userDao = $ this ->_getUser ($ args );
514
+ try
515
+ {
516
+ $ folders = $ folderModel ->getChildrenFoldersFiltered ($ folder , $ userDao );
517
+ }
518
+ catch (Exception $ e )
519
+ {
520
+ throw new Exception ($ e ->getMessage (), MIDAS_INTERNAL_ERROR );
521
+ }
522
+
523
+ return array ('folders ' => $ folders );
524
+ }
525
+
491
526
/**
492
527
* Return a list of all communities visible to a user
493
528
* @param token (Optional) Authentication token
You can’t perform that action at this time.
0 commit comments