Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r504 - registry/trunk/app/Controller

Subject: COmanage Developers List

List archive

[comanage-dev] r504 - registry/trunk/app/Controller


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r504 - registry/trunk/app/Controller
  • Date: Fri, 19 Apr 2013 18:44:32 -0400
  • Authentication-results: sfpop-ironport01.merit.edu; dkim=neutral (message not signed) header.i=none

Author: benno
Date: 2013-04-19 18:44:32 -0400 (Fri, 19 Apr 2013)
New Revision: 504

Modified:
registry/trunk/app/Controller/CoGroupMembersController.php
Log:
Log history on CO Group Member change (CO-96)

Modified: registry/trunk/app/Controller/CoGroupMembersController.php
===================================================================
--- registry/trunk/app/Controller/CoGroupMembersController.php 2013-04-19
22:42:46 UTC (rev 503)
+++ registry/trunk/app/Controller/CoGroupMembersController.php 2013-04-19
22:44:32 UTC (rev 504)
@@ -226,8 +226,61 @@

return(true);
}
-
+
/**
+ * Generate history records for a transaction. This method is intended to
be
+ * overridden by model-specific controllers, and will be called from
within a
+ * try{} block so that HistoryRecord->record() may be called without
worrying
+ * about catching exceptions.
+ *
+ * @since COmanage Registry v0.8
+ * @param String Controller action causing the change
+ * @param Array Data provided as part of the action (for add/edit)
+ * @param Array Previous data (for delete/edit)
+ * @return boolean Whether the function completed successfully (which does
not necessarily imply history was recorded)
+ */
+
+ public function generateHistory($action, $newdata, $olddata) {
+ switch($action) {
+ case 'add':
+
$this->CoGroupMember->CoPerson->HistoryRecord->record($olddata['CoGroupMember']['co_person_id'],
+ null,
+ null,
+
$this->Session->read('Auth.User.co_person_id'),
+
ActionEnum::CoGroupMemberAdded,
+
_txt('rs.grm.added', array($olddata['CoGroup']['name'],
+
$olddata['CoGroup']['id'],
+
_txt($newdata['CoGroupMember']['member'] ? 'fd.yes' : 'fd.no'),
+
_txt($newdata['CoGroupMember']['owner'] ? 'fd.yes' : 'fd.no'))));
+ break;
+ case 'delete':
+
$this->CoGroupMember->CoPerson->HistoryRecord->record($olddata['CoGroupMember']['co_person_id'],
+ null,
+ null,
+
$this->Session->read('Auth.User.co_person_id'),
+
ActionEnum::CoGroupMemberDeleted,
+
_txt('rs.grm.deleted', array($olddata['CoGroup']['name'],
+
$olddata['CoGroup']['id'])));
+ break;
+ case 'edit':
+
$this->CoGroupMember->CoPerson->HistoryRecord->record($olddata['CoGroupMember']['co_person_id'],
+ null,
+ null,
+
$this->Session->read('Auth.User.co_person_id'),
+
ActionEnum::CoGroupMemberEdited,
+
_txt('rs.grm.edited', array($olddata['CoGroup']['name'],
+
$olddata['CoGroup']['id'],
+
_txt($olddata['CoGroupMember']['member'] ? 'fd.yes' : 'fd.no'),
+
_txt($olddata['CoGroupMember']['owner'] ? 'fd.yes' : 'fd.no'),
+
_txt($newdata['CoGroupMember']['member'] ? 'fd.yes' : 'fd.no'),
+
_txt($newdata['CoGroupMember']['owner'] ? 'fd.yes' : 'fd.no'))));
+ break;
+ }
+
+ return true;
+ }
+
+ /**
* Authorization for this Controller, called by Auth component
* - precondition: Session.Auth holds data used for authz decisions
* - postcondition: $permissions set with calculated permissions



  • [comanage-dev] r504 - registry/trunk/app/Controller, svnlog, 04/19/2013

Archive powered by MHonArc 2.6.16.

Top of Page