Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r507 - registry/trunk/app/Model/Behavior

Subject: COmanage Developers List

List archive

[comanage-dev] r507 - registry/trunk/app/Model/Behavior


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r507 - registry/trunk/app/Model/Behavior
  • Date: Mon, 22 Apr 2013 12:38:06 -0400
  • Authentication-results: sfpop-ironport02.merit.edu; dkim=neutral (message not signed) header.i=none

Author: skoranda
Date: 2013-04-22 12:38:06 -0400 (Mon, 22 Apr 2013)
New Revision: 507

Modified:
registry/trunk/app/Model/Behavior/ProvisionerBehavior.php
Log:
ProvisionerBehavior support Grouper data source (CO-606)

Modified: registry/trunk/app/Model/Behavior/ProvisionerBehavior.php
===================================================================
--- registry/trunk/app/Model/Behavior/ProvisionerBehavior.php 2013-04-22
13:21:40 UTC (rev 506)
+++ registry/trunk/app/Model/Behavior/ProvisionerBehavior.php 2013-04-22
16:38:06 UTC (rev 507)
@@ -25,6 +25,10 @@
// Behaviors don't have access to sessions by default
App::uses('CakeSession', 'Model/Datasource');

+// Direct calls using models necessary since may use Grouper data source.
+App::uses('CoGroupMember', 'Model');
+App::uses('CoGroup', 'Model');
+
class ProvisionerBehavior extends ModelBehavior {
/**
* Handle provisioning following delete of Model.
@@ -340,8 +344,9 @@
// Only pull related models relevant for provisioning
$args['contain'] = array(
'Co',
- 'CoGroupMember',
- 'CoGroupMember.CoGroup',
+ // Group information handled directly below to support Grouper use
case.
+ //'CoGroupMember',
+ //'CoGroupMember.CoGroup',
'CoOrgIdentityLink',
'CoPersonRole',
'CoPersonRole.Address',
@@ -353,7 +358,29 @@
);

$coPersonData = $coPersonModel->find('first', $args);
+
+ // Directly query for all group memberships instead of using
+ // relations in order to support Grouper use cases.
+ $coGroupMemberModel = new CoGroupMember();

+ $args = array();
+ $args['conditions']['CoGroupMember.co_person_id'] = $coPersonId;
+
+ $memberships = $coGroupMemberModel->find('all', $args);
+
+ $coPersonData['CoGroupMember'] = array();
+ foreach ($memberships as &$m) {
+ $groupId = $m['CoGroupMember']['co_group_id'];
+ $coGroupModel = new CoGroup();
+
+ $args = array();
+ $args['conditions']['CoGroup.id'] = $groupId;
+
+ $group = $coGroupModel->find('first', $args);
+ $m['CoGroupMember']['CoGroup'] = $group['CoGroup'];
+ $coPersonData['CoGroupMember'][] = $m['CoGroupMember'];
+ }
+
if(empty($coPersonData)) {
throw new InvalidArgumentException(_txt('er.cop.unk'));
}
@@ -406,4 +433,4 @@

return $coPersonData;
}
-}
\ No newline at end of file
+}



  • [comanage-dev] r507 - registry/trunk/app/Model/Behavior, svnlog, 04/22/2013

Archive powered by MHonArc 2.6.16.

Top of Page