comanage-dev - [comanage-dev] r261 - in registry/trunk/app: Controller Model
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r261 - in registry/trunk/app: Controller Model
- Date: Wed, 14 Mar 2012 16:55:27 -0400
Author: marie
Date: 2012-03-14 16:55:27 -0400 (Wed, 14 Mar 2012)
New Revision: 261
Modified:
registry/trunk/app/Controller/CousController.php
registry/trunk/app/Model/Cou.php
Log:
co-229 part 1: fixes call to isChildCou, adds type check to return
Modified: registry/trunk/app/Controller/CousController.php
===================================================================
--- registry/trunk/app/Controller/CousController.php 2012-03-14 07:47:21
UTC (rev 260)
+++ registry/trunk/app/Controller/CousController.php 2012-03-14 20:55:27
UTC (rev 261)
@@ -164,7 +164,7 @@
}
// Check if parent would cause a loop
- if($this->Cou->isChildCou($this->viewVars['cur_co']['Cou']['id'],
$parentCou) )
+ if($this->Cou->isChildCou($reqdata['Cou']['id'], $parentCou))
{
if($this->restful)
$this->restResultHeader(403, "Parent Would Create Cycle");
Modified: registry/trunk/app/Model/Cou.php
===================================================================
--- registry/trunk/app/Model/Cou.php 2012-03-14 07:47:21 UTC (rev 260)
+++ registry/trunk/app/Model/Cou.php 2012-03-14 20:55:27 UTC (rev 261)
@@ -215,19 +215,23 @@
* Check if couNode is a child of couBranch.
*
* @since COmanage Registry v0.3
- * @param Array Head of the branch to be searched
- * @param string Node to be looked for
+ * @param integer Head of the branch to be searched
+ * @param integer Node to be looked for
* @return boolean True if child, false otherwise
*/
-
+
public function isChildCou($couBranch, $couNode) {
+
+ // Get list of all children of $couBranch
$childrenArrays = $this->children($couBranch, false, 'id');
$childrenList = Set::extract($childrenArrays, '{n}.Cou.id');
// Check for NULL to avoid warning/error from array_search (See CO-240)
- if($childrenList == NULL)
- return false;
- else
- return(array_search($couNode, $childrenList));
+ if(($childrenList != NULL)
+ && (array_search($couNode, $childrenList) !== false)) {
+ // Node was found in the branch
+ return true;
+ }
+ return false;
}
}
- [comanage-dev] r261 - in registry/trunk/app: Controller Model, svnlog, 03/14/2012
Archive powered by MHonArc 2.6.16.