Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r391 - in registry/trunk: app/Config app/Console/Command app/Controller app/Model app/Plugin app/Plugin/Grouper app/Plugin/Grouper/Config app/Plugin/Grouper/Lib app/Plugin/Grouper/Model app/Plugin/Grouper/Model/Datasource app/View/CoInvites lib/Cake/Model/Datasource

Subject: COmanage Developers List

List archive

[comanage-dev] r391 - in registry/trunk: app/Config app/Console/Command app/Controller app/Model app/Plugin app/Plugin/Grouper app/Plugin/Grouper/Config app/Plugin/Grouper/Lib app/Plugin/Grouper/Model app/Plugin/Grouper/Model/Datasource app/View/CoInvites lib/Cake/Model/Datasource


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r391 - in registry/trunk: app/Config app/Console/Command app/Controller app/Model app/Plugin app/Plugin/Grouper app/Plugin/Grouper/Config app/Plugin/Grouper/Lib app/Plugin/Grouper/Model app/Plugin/Grouper/Model/Datasource app/View/CoInvites lib/Cake/Model/Datasource
  • Date: Thu, 25 Oct 2012 18:56:14 -0400

Author: skoranda
Date: 2012-10-25 18:56:14 -0400 (Thu, 25 Oct 2012)
New Revision: 391

Added:
registry/trunk/app/Plugin/Grouper/
registry/trunk/app/Plugin/Grouper/Config/
registry/trunk/app/Plugin/Grouper/Config/bootstrap.php
registry/trunk/app/Plugin/Grouper/Lib/
registry/trunk/app/Plugin/Grouper/Lib/GrouperCoGroup.php
registry/trunk/app/Plugin/Grouper/Lib/GrouperCoGroupException.php

registry/trunk/app/Plugin/Grouper/Lib/GrouperCoGroupMemberSourceException.php
registry/trunk/app/Plugin/Grouper/Lib/GrouperCoGroupSourceException.php
registry/trunk/app/Plugin/Grouper/Lib/GrouperCoMembers.php
registry/trunk/app/Plugin/Grouper/Lib/GrouperCoMembersException.php
registry/trunk/app/Plugin/Grouper/Lib/GrouperCoStem.php
registry/trunk/app/Plugin/Grouper/Lib/GrouperCoStemException.php
registry/trunk/app/Plugin/Grouper/Lib/GrouperRestClient.php
registry/trunk/app/Plugin/Grouper/Lib/GrouperRestClientException.php
registry/trunk/app/Plugin/Grouper/Model/
registry/trunk/app/Plugin/Grouper/Model/Datasource/
registry/trunk/app/Plugin/Grouper/Model/Datasource/CoGroupMemberSource.php
registry/trunk/app/Plugin/Grouper/Model/Datasource/CoGroupSource.php
Modified:
registry/trunk/app/Config/bootstrap.php
registry/trunk/app/Console/Command/DatabaseShell.php
registry/trunk/app/Console/Command/SetupShell.php
registry/trunk/app/Controller/CoGroupMembersController.php
registry/trunk/app/Controller/CoGroupsController.php
registry/trunk/app/Controller/CoInvitesController.php
registry/trunk/app/Controller/CoPeopleController.php
registry/trunk/app/Controller/StandardController.php
registry/trunk/app/Controller/UsersController.php
registry/trunk/app/Model/CoGroup.php
registry/trunk/app/Model/CoGroupMember.php
registry/trunk/app/View/CoInvites/send.ctp
registry/trunk/lib/Cake/Model/Datasource/DboSource.php
Log:
Grouper data source integration (CO-268)
Show email link when in debug mode (CO-352)

Modified: registry/trunk/app/Config/bootstrap.php
===================================================================
--- registry/trunk/app/Config/bootstrap.php 2012-10-23 23:19:34 UTC (rev
390)
+++ registry/trunk/app/Config/bootstrap.php 2012-10-25 22:56:14 UTC (rev
391)
@@ -67,6 +67,11 @@
*
*/

+// Always load the Grouper plugin whether or not it will be used.
+// Configuration of the plugin determines if it will be used.
+// See Plugin/Grouper/Config/bootstrap.php.
+CakePlugin::load('Grouper', array('bootstrap' => true));
+
include APP."Lib/enum.php";
include APP."Lib/lang.php";
include APP."Lib/util.php";

Modified: registry/trunk/app/Console/Command/DatabaseShell.php
===================================================================
--- registry/trunk/app/Console/Command/DatabaseShell.php 2012-10-23
23:19:34 UTC (rev 390)
+++ registry/trunk/app/Console/Command/DatabaseShell.php 2012-10-25
22:56:14 UTC (rev 391)
@@ -48,8 +48,7 @@
if($dbc->Connect($db->config['host'],
$db->config['login'],
$db->config['password'],
- $db->config['database']))
- {
+ $db->config['database'])) {
$schema = new adoSchema($dbc);
$schema->setPrefix($db->config['prefix']);
// ParseSchema is generating bad SQL for Postgres. eg:
@@ -66,12 +65,10 @@
//
// https://bugs.internet2.edu/jira/browse/CO-175
//
- if ($db_driver[1] != 'Mysql')
- {
+ if ($db_driver[1] != 'Mysql') {
$sql = $schema->ParseSchema(APP . '/Config/Schema/schema.xml');
}
- else
- {
+ else {
$xml = new DOMDocument;
$xml->load(APP . '/Config/Schema/schema.xml');

@@ -84,8 +81,7 @@
$sql = $schema->ParseSchemaString($proc->transformToXML($xml));
}

- switch($schema->ExecuteSchema($sql))
- {
+ switch($schema->ExecuteSchema($sql)) {
case 2: // !!!
$this->out(_txt('op.db.ok'));
break;
@@ -96,8 +92,7 @@

$dbc->Disconnect();
}
- else
- {
+ else {
$this->out(_txt('er.db.connect', array($dbc->ErrorMsg())));
exit;
}

Modified: registry/trunk/app/Console/Command/SetupShell.php
===================================================================
--- registry/trunk/app/Console/Command/SetupShell.php 2012-10-23 23:19:34
UTC (rev 390)
+++ registry/trunk/app/Console/Command/SetupShell.php 2012-10-25 22:56:14
UTC (rev 391)
@@ -53,6 +53,50 @@
FROM cm_identifiers i
WHERE i.login=true;
");
+
+ // Determine if we should create a view for Grouper to
+ // use as a JDBC source in the Grouper sources.xml configuration
+ // and create the view if necessary.
+ $createGrouperSourceView =
Configure::read('Grouper.useCOmanageSubjectSource');
+ if ($createGrouperSourceView) {
+
+ // Determine which database is being used.
+ $db =& ConnectionManager::getDataSource('default');
+ $db_driver = split("/", $db->config['datasource'], 2);
+
+ // The view syntax is different for each database product.
+ if ($db_driver[1] == 'Mysql') {
+ $this->Identifier->query("CREATE VIEW " . $prefix .
"grouper_subjects AS
+SELECT
+ cm_co_people.id AS 'id',
+ CONCAT(GROUP_CONCAT(DISTINCT cm_names.given),' ',GROUP_CONCAT(DISTINCT
cm_names.family)) AS 'name',
+ CONCAT(GROUP_CONCAT(DISTINCT cm_names.family),',',GROUP_CONCAT(DISTINCT
cm_names.given)) AS 'lfname',
+ CONCAT(GROUP_CONCAT(DISTINCT cm_names.given),' ',GROUP_CONCAT(DISTINCT
cm_names.family),' (',GROUP_CONCAT(DISTINCT cm_cos.description),')') AS
'description',
+ SUBSTRING_INDEX(GROUP_CONCAT(DISTINCT cm_identifiers.identifier),',',1)
AS 'loginid1',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(GROUP_CONCAT(DISTINCT
cm_identifiers.identifier),','),',',2),',',-1) AS 'loginid2',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(GROUP_CONCAT(DISTINCT
cm_identifiers.identifier),','),',',3),',',-1) AS 'loginid3',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(GROUP_CONCAT(DISTINCT
cm_identifiers.identifier),','),',',4),',',-1) AS 'loginid4',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(GROUP_CONCAT(DISTINCT
cm_identifiers.identifier),','),',',5),',',-1) AS 'loginid5',
+ SUBSTRING_INDEX(GROUP_CONCAT(DISTINCT cm_email_addresses.mail),',',1) AS
'email1',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(GROUP_CONCAT(DISTINCT
cm_email_addresses.mail),','),',',2),',',-1) AS 'email2',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(GROUP_CONCAT(DISTINCT
cm_email_addresses.mail),','),',',3),',',-1) AS 'email3',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(GROUP_CONCAT(DISTINCT
cm_email_addresses.mail),','),',',4),',',-1) AS 'email4',
+ SUBSTRING_INDEX(SUBSTRING_INDEX(CONCAT(GROUP_CONCAT(DISTINCT
cm_email_addresses.mail),','),',',5),',',-1) AS 'email5'
+FROM
+ cm_co_people
+ LEFT JOIN cm_names ON cm_co_people.id = cm_names.co_person_id
+ LEFT JOIN cm_identifiers ON cm_co_people.id = cm_identifiers.co_person_id
+ LEFT JOIN cm_email_addresses ON cm_co_people.id =
cm_email_addresses.co_person_id
+ LEFT JOIN cm_cos ON cm_co_people.co_id = cm_cos.id
+GROUP BY
+ cm_co_people.id
+");
+
+ } else {
+ // Only support MySQL for now so throw exception.
+ throw new RuntimeException('Grouper support requires MySQL at this
time');
+ }
+ }

// We need the following:
// - The COmanage CO

Modified: registry/trunk/app/Controller/CoGroupMembersController.php
===================================================================
--- registry/trunk/app/Controller/CoGroupMembersController.php 2012-10-23
23:19:34 UTC (rev 390)
+++ registry/trunk/app/Controller/CoGroupMembersController.php 2012-10-25
22:56:14 UTC (rev 391)
@@ -95,7 +95,15 @@

if(count($a['CoGroupMember']) > 0)
{
- if($this->CoGroupMember->saveAll($a['CoGroupMember']))
+ // When using the Grouper dataSource we need to set the
+ // atomic option for saveAll() to false.
+ if (Configure::read('Grouper.COmanage.useGrouperDataSource')) {
+ $atomic = false;
+ } else {
+ $atomic = true;
+ }
+
+ if($this->CoGroupMember->saveAll($a['CoGroupMember'], array('atomic'
=> $atomic)))
$this->Session->setFlash(_txt('rs.added'), '', array(), 'success');
else

$this->Session->setFlash($this->fieldsErrorToString($this->CoGroupMember->invalidFields()),
'', array(), 'error');
@@ -146,7 +154,11 @@
function checkWriteDependencies($reqdata, $curdata = null) {
// Make sure the Group exists

- $g =
$this->CoGroupMember->CoGroup->findById($reqdata['CoGroupMember']['co_group_id']);
+ $g = $this->CoGroupMember->CoGroup->find('first',
+ array('conditions' =>
+ array('CoGroup.id' =>
$reqdata['CoGroupMember']['co_group_id'])
+ )
+ );

if(empty($g))
{
@@ -163,7 +175,11 @@

// Make sure the CO Person exists

- $p =
$this->CoGroupMember->CoPerson->findById($reqdata['CoGroupMember']['co_person_id']);
+ $p = $this->CoGroupMember->CoPerson->find('first',
+ array('conditions' =>
+ array('CoPerson.id' =>
$reqdata['CoGroupMember']['co_person_id'])
+ )
+ );

if(empty($p))
{
@@ -346,18 +362,44 @@
// Set page title
$this->set('title_for_layout', _txt('op.select-a',
array(_txt('ct.co_group_members.1'))));

- // Find available people
- // XXX remove people already members
+ // Find all available CO people.

- $dbo = $this->CoGroupMember->getDataSource();
-
$this->paginate['conditions'] = array(
'co_id' => $this->cur_co['Co']['id']
);
+ $allCoPeople = $this->paginate('CoPerson');
+
+ // Find all current group members and create an array
+ // of the corresponding CO person Ids.
+ $groupId = $this->request->params['named']['cogroup'];
+ $allGroupMembers = $this->CoGroupMember->find('all',
+ array(
+ 'conditions' =>
+
array('CoGroupMember.co_group_id' => $groupId),
+ 'recursive' => -1)
+ );
+ $allGroupMembersCoPersonId = array();
+ foreach($allGroupMembers as $member){
+ $allGroupMembersCoPersonId[] =
$member['CoGroupMember']['co_person_id'];
+ }
+
+ // Filter out CO people that are already members.
+ foreach($allCoPeople as $key => &$coPerson) {
+ if (in_array($coPerson['CoPerson']['id'], $allGroupMembersCoPersonId))
{
+ unset($allCoPeople[$key]);
+ }
+ }
+
+ $this->set('co_people', $allCoPeople);

- $this->set('co_people', $this->paginate('CoPerson'));;
-
- if(isset($this->request->params['named']['cogroup']))
- $this->set('co_group',
$this->CoGroupMember->CoGroup->findById($this->request->params['named']['cogroup']));
+ // Also find the Group so that its details like name
+ // can be rendered.
+ $coGroup = $this->CoGroupMember->CoGroup->find('first',
+ array('conditions' =>
+ array('CoGroup.id' =>
$groupId)
+ )
+ );
+
+ $this->set('co_group', $coGroup);
}
}

Modified: registry/trunk/app/Controller/CoGroupsController.php
===================================================================
--- registry/trunk/app/Controller/CoGroupsController.php 2012-10-23
23:19:34 UTC (rev 390)
+++ registry/trunk/app/Controller/CoGroupsController.php 2012-10-25
22:56:14 UTC (rev 391)
@@ -167,11 +167,41 @@

if(!$this->restful && $this->request->is('get'))
{
- $this->CoGroup->CoGroupMember->recursive = 2;
- $x = $this->CoGroup->CoGroupMember->find('all', array('conditions' =>
-
array('CoGroupMember.co_group_id' => $id)));
+ // Retrieve the set of all group members but since the
+ // Grouper dataSource may be used and does not support
+ // recursion construct the necessary recursive information
+ // directly.
+ $allGroupMembers = $this->CoGroup->CoGroupMember->find('all',
+
array('conditions' =>
+
array('CoGroupMember.co_group_id' => $id)
+ )
+ );
+
+ $this->loadModel('CoPerson');
+ $this->loadModel('Name');

- $this->set('co_group_members', $x);
+ foreach($allGroupMembers as &$member) {
+ $coPersonId = $member['CoGroupMember']['co_person_id'];
+ $coPerson = $this->CoPerson->find('first',
+ array(
+ 'conditions' =>
+ array('CoPerson.id' =>
$coPersonId),
+ 'recursive' => -1
+ )
+ );
+ $name = $this->Name->find('first',
+ array(
+ 'conditions' =>
+ array('Name.co_person_id' =>
$coPersonId),
+ 'recursive' => -1
+ )
+ );
+ $coPerson['CoPerson']['CoGroupMember'] =
array($member['CoGroupMember']);
+ $coPerson['CoPerson']['Name'] = $name['Name'];
+ $member = array_merge($member, $coPerson);
+ }
+
+ $this->set('co_group_members', $allGroupMembers);
}

// Invoke the StandardController edit
@@ -300,7 +330,12 @@
if(isset($member) && in_array($this->request->params['pass'][0],
$p['member']))
$p['view'] = true;

- $g = $this->CoGroup->findById($this->request->params['pass'][0]);
+ $params = array(
+ 'conditions' => array(
+ 'CoGroup.id' => $this->request->params['pass'][0]
+ )
+ );
+ $g = $this->CoGroup->find('first', $params);

if($g)
{

Modified: registry/trunk/app/Controller/CoInvitesController.php
===================================================================
--- registry/trunk/app/Controller/CoInvitesController.php 2012-10-23
23:19:34 UTC (rev 390)
+++ registry/trunk/app/Controller/CoInvitesController.php 2012-10-25
22:56:14 UTC (rev 391)
@@ -517,10 +517,16 @@
$this->Session->setFlash(_txt('er.cop.nf', array($cpid)), '',
array(), 'error');
}

- // Redirect to My Population
- $nextPage = array('controller' => 'co_people',
- 'action' => 'index',
- 'co' => $this->cur_co['Co']['id']);
- $this->redirect($nextPage);
+ $debug = Configure::read('debug');
+ if(!$debug) {
+ // Redirect to My Population when no debugging so that
+ // user sees flash message that email was sent with invitation.
+ // Otherwise when debugging user will see link to the invitation
+ // to help debugging and testing.
+ $nextPage = array('controller' => 'co_people',
+ 'action' => 'index',
+ 'co' => $this->cur_co['Co']['id']);
+ $this->redirect($nextPage);
+ }
}
}

Modified: registry/trunk/app/Controller/CoPeopleController.php
===================================================================
--- registry/trunk/app/Controller/CoPeopleController.php 2012-10-23
23:19:34 UTC (rev 390)
+++ registry/trunk/app/Controller/CoPeopleController.php 2012-10-25
22:56:14 UTC (rev 391)
@@ -244,6 +244,44 @@
$this->view($id);
}
}
+
+ /**
+ * Delete a CoPerson Object. WARNING: this method will delete all
associated data.
+ * This method calls the StandardController delete() method after first
temporarily changing
+ * model dependecies if necessary to compensate for data sources used for
groups and group
+ * memberships that may not use SQL and support cascading deletes.
+ *
+ * - precondition: see StandardController
+ * - postcondition: see StandardController
+ * - postcondition: see StandardController
+ *
+ * @since COmanage Registry v0.8
+ * @param integer Object identifier (eg: cm_co_groups:id) representing
object to be deleted
+ */
+ function delete($id) {
+ // If a data store for groups and group memberships is being used that
+ // is not a relational database supporting SQL then temporarily remove
+ // the model relationship to group memberships.
+ //
+ // May need to revisit at some point due to
+ // https://bugs.internet2.edu/jira/browse/CO-444.
+ if (!Configure::read('COmanage.groupSqlDataSource')) {
+ $groupMembersLinkValue = $this->CoPerson->hasMany['CoGroupMember'];
+ unset($this->CoPerson->hasMany['CoGroupMember']);
+
+ // Use the parent method to do the delete.
+ $ret = parent::delete($id);
+
+ // TODO delete the memberships...
+
+ // Restore the model relationship to group memberships if it was
deleted.
+ $this->CoPerson->hasMany['CoGroupMember'] = $groupMembersLinkValue;
+ } else {
+ // Use the parent method to do the delete.
+ $ret = parent::delete($id);
+ }
+ return $ret;
+ }

/**
* Generate a display key to be used in messages such as "Item Added".

Modified: registry/trunk/app/Controller/StandardController.php
===================================================================
--- registry/trunk/app/Controller/StandardController.php 2012-10-23
23:19:34 UTC (rev 390)
+++ registry/trunk/app/Controller/StandardController.php 2012-10-25
22:56:14 UTC (rev 391)
@@ -78,9 +78,17 @@
if(!$this->checkWriteDependencies($data))
return;

- // Finally, try to save
+ // Finally, try to save. We need to do a non-atomic saveAll()
+ // when using the Grouper dataSource.

- if($model->saveAll($data)) {
+ if (($req === 'CoGroup' or $req === 'CoGroupMember') and
+ Configure::read('Grouper.COmanage.useGrouperDataSource')) {
+ $atomic = false;
+ } else {
+ $atomic = true;
+ }
+
+ if($model->saveAll($data,array('atomic' => $atomic))) {
if(!$this->recordHistory('add', $data)
|| !$this->checkWriteFollowups($data)) {
if(!$this->restful) {
@@ -221,10 +229,19 @@
$this->performRedirect();
return;
}
-
- // Remove the object

- if($model->delete($id))
+ // Do not do a cascading delete if the model does not
+ // use a SQL compatible data source.
+ $cascadeDelete = true;
+ if(property_exists($model->name, 'usesSqlDataSource')) {
+ if(!$model->usesSqlDataSource) {
+ $cascadeDelete = false;
+ }
+ }
+
+ // Remove the object.
+
+ if($model->delete($id, $cascadeDelete))
{
if($this->recordHistory('delete', null, $op)) {
if($this->restful)
@@ -365,9 +382,18 @@
if(!$this->checkWriteDependencies($data, $curdata))
return;

- // Finally, try to save
+ // Finally, try to save.

- if($model->saveAll($data))
+ // Do not not require an atomic operation if the model does not
+ // use a SQL compatible data source.
+ $atomic = true;
+ if(property_exists($model->name, 'usesSqlDataSource')) {
+ if(!$model->usesSqlDataSource) {
+ $atomic = false;
+ }
+ }
+
+ if($model->saveAll($data, array('atomic' => $atomic)))
{
if(!$this->recordHistory('edit', $data, $curdata)
|| !$this->checkWriteFollowups($data, $curdata)) {

Modified: registry/trunk/app/Controller/UsersController.php
===================================================================
--- registry/trunk/app/Controller/UsersController.php 2012-10-23 23:19:34
UTC (rev 390)
+++ registry/trunk/app/Controller/UsersController.php 2012-10-25 22:56:14
UTC (rev 391)
@@ -128,18 +128,36 @@

// And assemble the Group Memberships

- foreach($l['CoPerson']['CoGroupMember'] as $gm)
- {
- $cos[ $l['CoPerson']['Co']['name'] ]['groups'][
$gm['CoGroup']['name'] ] = array(
- 'co_group_id' => $gm['co_group_id'],
- 'name' => $gm['CoGroup']['name'],
- 'member' => $gm['member'],
- 'owner' => $gm['owner']
+ $this->loadModel('CoGroupMember');
+ $this->loadModel('CoGroup');
+
+ $params = array(
+ 'conditions' => array(
+ 'CoGroupMember.co_person_id' => $l['co_person_id']
+ )
);
+ $memberships = $this->CoGroupMember->find('all', $params);
+
+ foreach($memberships as $m){
+ $params = array(
+ 'conditions' => array(
+ 'CoGroup.id' => $m['CoGroupMember']['co_group_id']
+ )
+ );
+ $result = $this->CoGroup->find('first', $params);
+ $group = $result['CoGroup'];
+ $this->log("group = " . print_r($group, true));
+
+ $cos[ $l['CoPerson']['Co']['name'] ]['groups'][
$group['name'] ] = array(
+ 'co_group_id' => $m['CoGroupMember']['co_group_id'],
+ 'name' => $group['name'],
+ 'member' => $m['CoGroupMember']['member'],
+ 'owner' => $m['CoGroupMember']['owner']
+ );
}
}
}
-
+
$this->Session->write('Auth.User.org_identities', $orgs);
$this->Session->write('Auth.User.cos', $cos);


Modified: registry/trunk/app/Model/CoGroup.php
===================================================================
--- registry/trunk/app/Model/CoGroup.php 2012-10-23 23:19:34 UTC (rev
390)
+++ registry/trunk/app/Model/CoGroup.php 2012-10-25 22:56:14 UTC (rev
391)
@@ -48,6 +48,11 @@
public $order = array("CoGroup.name");

public $actsAs = array('Containable');
+
+ // If true the data source for the model uses a relational database
+ // backend and if false then the data source is something else, perhaps
+ // Grouper or similar.
+ public $usesSqlDataSource = true;

// Validation rules for table elements
public $validate = array(
@@ -81,6 +86,33 @@
public $cm_enum_types = array(
'status' => 'status_t'
);
+
+ /**
+ * Constructor
+ * - precondition:
+ * - postcondition:
+ *
+ * @since COmanage Directory 0.7
+ * @return instance
+ */
+ public function __construct($id = false, $table = null, $ds = null){
+
+ // Depending on the configuration use the Grouper
+ // plugin data source or the default data source.
+ if (Configure::read('Grouper.COmanage.useGrouperDataSource')) {
+ $this->useDbConfig = 'grouperCoGroup';
+ }
+
+ // Depending on the configuration signal that we
+ // do not use a SQL relational database backend for the
+ // data source.
+ if (!Configure::read('COmanage.groupSqlDataSource')) {
+ $this->usesSqlDataSource = false;
+ }
+
+ parent::__construct($id, $table, $ds);
+ }
+

/**
* Obtain all groups for a CO person.

Modified: registry/trunk/app/Model/CoGroupMember.php
===================================================================
--- registry/trunk/app/Model/CoGroupMember.php 2012-10-23 23:19:34 UTC (rev
390)
+++ registry/trunk/app/Model/CoGroupMember.php 2012-10-25 22:56:14 UTC (rev
391)
@@ -43,13 +43,14 @@
public $order = array("co_person_id");

public $actsAs = array('Containable');
+
+ // If true the data source for the model uses a relational database
+ // backend and if false then the data source is something else, perhaps
+ // Grouper or similar.
+ public $usesSqlDataSource = true;

// Validation rules for table elements
public $validate = array(
- 'co_group_id' => array(
- 'rule' => 'numeric',
- 'required' => true
- ),
'co_person_id' => array(
'rule' => 'numeric',
'required' => true
@@ -61,6 +62,32 @@
'rule' => array('boolean')
)
);
+
+ /**
+ * Constructor
+ * - precondition:
+ * - postcondition:
+ *
+ * @since COmanage Directory 0.7
+ * @return instance
+ */
+ public function __construct($id = false, $table = null, $ds = null){
+
+ // Depending on the configuration use the Grouper
+ // plugin data source or the default data source.
+ if(Configure::read('Grouper.COmanage.useGrouperDataSource')) {
+ $this->useDbConfig = 'grouperCoGroupMember';
+ }
+
+ // Depending on the configuration signal that we
+ // do not use a SQL relational database backend for the
+ // data source.
+ if (!Configure::read('COmanage.groupSqlDataSource')) {
+ $this->usesSqlDataSource = false;
+ }
+
+ parent::__construct($id, $table, $ds);
+ }

/**
* Obtain the group roles for a CO person.

Modified: registry/trunk/app/View/CoInvites/send.ctp
===================================================================
--- registry/trunk/app/View/CoInvites/send.ctp 2012-10-23 23:19:34 UTC (rev
390)
+++ registry/trunk/app/View/CoInvites/send.ctp 2012-10-25 22:56:14 UTC (rev
391)
@@ -28,6 +28,9 @@
?>

<p>
+You are seeing this text because <b>debug</b> is true in the configuration
file <b>app/Config/core.php</b>.
+</p>
+<p>
Email would be sent to <b><?php echo $invite['CoInvite']['mail']; ?></b>
with the URL
<br />
<br />

Modified: registry/trunk/lib/Cake/Model/Datasource/DboSource.php
===================================================================
--- registry/trunk/lib/Cake/Model/Datasource/DboSource.php 2012-10-23
23:19:34 UTC (rev 390)
+++ registry/trunk/lib/Cake/Model/Datasource/DboSource.php 2012-10-25
22:56:14 UTC (rev 391)
@@ -1079,7 +1079,6 @@
$this->_filterResults($resultSet, $model,
$filtered);
}
}
-
if (!is_null($recursive)) {
$model->recursive = $_recursive;
}
@@ -1163,7 +1162,9 @@
} else {
$db =
ConnectionManager::getDataSource($deepModel->useDbConfig);
}
-
$db->queryAssociation($linkModel, $deepModel, $type1, $assoc1, $assocData1,
$queryData, true, $fetch, $recursive - 1, $tmpStack);
+ if
(method_exists($db, 'queryAssociation')) {
+ $db->queryAssociation($linkModel, $deepModel, $type1,
$assoc1, $assocData1, $queryData, true, $fetch, $recursive - 1, $tmpStack);
+ }
}
}
}
@@ -1231,7 +1232,9 @@
}
else {

$db = ConnectionManager::getDataSource($deepModel->useDbConfig);
}
-
$db->queryAssociation($linkModel, $deepModel, $type1, $assoc1, $assocData1,
$queryData, true, $fetch, $recursive - 1, $tmpStack);
+ if
(method_exists($db, 'queryAssociation')) {
+ $db->queryAssociation($linkModel, $deepModel, $type1,
$assoc1, $assocData1, $queryData, true, $fetch, $recursive - 1, $tmpStack);
+ }
}
}
}



  • [comanage-dev] r391 - in registry/trunk: app/Config app/Console/Command app/Controller app/Model app/Plugin app/Plugin/Grouper app/Plugin/Grouper/Config app/Plugin/Grouper/Lib app/Plugin/Grouper/Model app/Plugin/Grouper/Model/Datasource app/View/CoInvites lib/Cake/Model/Datasource, svnlog, 10/25/2012

Archive powered by MHonArc 2.6.16.

Top of Page