comanage-dev - [comanage-dev] r231 - in registry/trunk/app: Controller Model
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r231 - in registry/trunk/app: Controller Model
- Date: Sat, 18 Feb 2012 11:49:01 -0500
Author: skoranda
Date: 2012-02-18 11:49:01 -0500 (Sat, 18 Feb 2012)
New Revision: 231
Modified:
registry/trunk/app/Controller/CoPeopleController.php
registry/trunk/app/Model/CoOrgIdentityLink.php
Log:
Fix for CO-242
Modified: registry/trunk/app/Controller/CoPeopleController.php
===================================================================
--- registry/trunk/app/Controller/CoPeopleController.php 2012-02-17
23:39:09 UTC (rev 230)
+++ registry/trunk/app/Controller/CoPeopleController.php 2012-02-18
16:49:01 UTC (rev 231)
@@ -249,6 +249,34 @@
}
/**
+ * Add the person identified by the Org Identity to the identified CO.
+ * - precondition: org_identity_id and co_id set in $this->request->params
+ *
+ * @since COmanage Registry v0.4
+ * @return void
+ */
+
+ function add() {
+ // The parent add() method is overridden here so that for non REST calls
+ // the validation can be relaxed to allow the normal saveAll() call
+ // in the parent add() method to complete without a validation error.
+ // If the validation is not relaxed so that co_person_id and
org_identity_id
+ // are not required then the validation of all the tables before any
updates
+ // will cause a validation error for the model CoOrgIdentityLink.
+
+ if(!$this->restful) {
+ $this->loadModel('CoOrgIdentityLink');
+
+ // dynamically relax the validation for the CoOrgIdentityLink model
+ $this->CoOrgIdentityLink->validate['co_person_id']['required'] = false;
+ $this->CoOrgIdentityLink->validate['org_identity_id']['required'] =
false;
+ }
+
+ // call the add() method for the parent StandardController class
+ parent::add();
+ }
+
+ /**
* Authorization for this Controller, called by Auth component
* - precondition: Session.Auth holds data used for authz decisions
* - postcondition: $permissions set with calculated permissions
Modified: registry/trunk/app/Model/CoOrgIdentityLink.php
===================================================================
--- registry/trunk/app/Model/CoOrgIdentityLink.php 2012-02-17 23:39:09
UTC (rev 230)
+++ registry/trunk/app/Model/CoOrgIdentityLink.php 2012-02-18 16:49:01
UTC (rev 231)
@@ -47,6 +47,9 @@
public $order = array("CoOrgIdentityLink.id");
// Validation rules for table elements
+ //
+ // 'required' => true for co_person_id and org_identity_id
+ // may be temporarily overridden during add() method of CoPeopleController.
public $validate = array(
'co_person_id' => array(
'rule' => 'numeric',
- [comanage-dev] r231 - in registry/trunk/app: Controller Model, svnlog, 02/18/2012
Archive powered by MHonArc 2.6.16.