Skip to Content.
Sympa Menu

comanage-dev - [comanage-dev] r616 - in registry/trunk/app: Config/Schema Controller Lib Model View/CoEnrollmentFlows

Subject: COmanage Developers List

List archive

[comanage-dev] r616 - in registry/trunk/app: Config/Schema Controller Lib Model View/CoEnrollmentFlows


Chronological Thread 
  • From:
  • To:
  • Subject: [comanage-dev] r616 - in registry/trunk/app: Config/Schema Controller Lib Model View/CoEnrollmentFlows
  • Date: Tue, 8 Oct 2013 16:56:20 -0400

Author: benno
Date: 2013-10-08 16:56:20 -0400 (Tue, 08 Oct 2013)
New Revision: 616

Modified:
registry/trunk/app/Config/Schema/schema.xml
registry/trunk/app/Controller/CoInvitesController.php
registry/trunk/app/Controller/CoPetitionsController.php
registry/trunk/app/Lib/lang.php
registry/trunk/app/Model/CoEnrollmentFlow.php
registry/trunk/app/View/CoEnrollmentFlows/fields.inc
Log:
Redirect targets for Enrollment Flows (CO-709)

Modified: registry/trunk/app/Config/Schema/schema.xml
===================================================================
--- registry/trunk/app/Config/Schema/schema.xml 2013-10-07 20:05:43 UTC (rev
615)
+++ registry/trunk/app/Config/Schema/schema.xml 2013-10-08 20:56:20 UTC (rev
616)
@@ -560,6 +560,8 @@
<field name="approval_subject" type="C" size="256" />
<field name="approval_body" type="X" size="4000" />
<field name="introduction_text" type="X" size="4000" />
+ <field name="redirect_on_submit" type="C" size="256" />
+ <field name="redirect_on_confirm" type="C" size="256" />
<field name="created" type="T" />
<field name="modified" type="T" />


Modified: registry/trunk/app/Controller/CoInvitesController.php
===================================================================
--- registry/trunk/app/Controller/CoInvitesController.php 2013-10-07
20:05:43 UTC (rev 615)
+++ registry/trunk/app/Controller/CoInvitesController.php 2013-10-08
20:56:20 UTC (rev 616)
@@ -236,6 +236,9 @@
*/

function process_invite($inviteid, $confirm, $loginIdentifier=null) {
+ // Grab the invite info in case we need it later (we're about to delete
it)
+ $invite = $this->CoInvite->findByInvitation($inviteid);
+
if(!$this->restful) {
// Set page title
$this->set('title_for_layout', _txt('op.inv.reply'));
@@ -276,10 +279,27 @@
}
}

- if($this->restful)
+ if($this->restful) {
$this->restResultHeader(200, "Deleted");
- else {
- if($loginIdentifier) {
+ } else {
+ // See if this invite was attached to a CO petition, and if so whether
a redirect
+ // URL was specified.
+
+ $targetUrl = null;
+
+ if(isset($invite['CoPetition']['id'])) {
+ $targetUrl =
$this->CoInvite->CoPetition->CoEnrollmentFlow->field('redirect_on_confirm',
+
array('CoEnrollmentFlow.id' =>
$invite['CoPetition']['co_enrollment_flow_id']));
+ }
+
+ if($targetUrl && $targetUrl != "") {
+ // This shouldn't be done for Account Linking enrollment flows,
since the user won't be logged out
+ // to force their linked identity to show up by logging in again.
+
+ // Make sure the petition ID is available in the session.
+ $this->Session->write('CoPetition.id', $invite['CoPetition']['id']);
+ $this->redirect($targetUrl);
+ } elseif($loginIdentifier) {
// If a login identifier was provided, force a logout

$this->Session->setFlash(_txt('rs.pt.relogin'), '', array(),
'success');

Modified: registry/trunk/app/Controller/CoPetitionsController.php
===================================================================
--- registry/trunk/app/Controller/CoPetitionsController.php 2013-10-07
20:05:43 UTC (rev 615)
+++ registry/trunk/app/Controller/CoPetitionsController.php 2013-10-08
20:56:20 UTC (rev 616)
@@ -88,10 +88,10 @@

$this->CoPetition->CoEnrollmentFlow->CoEnrollmentAttribute->enrollmentFlowAttributes($enrollmentFlowID));

try {
- $this->CoPetition->createPetition($enrollmentFlowID,
- $this->cur_co['Co']['id'],
- $this->request->data,
-
$this->Session->read('Auth.User.co_person_id'));
+ $petitionId = $this->CoPetition->createPetition($enrollmentFlowID,
+
$this->cur_co['Co']['id'],
+
$this->request->data,
+
$this->Session->read('Auth.User.co_person_id'));

$matchPolicy =
$this->CoPetition->CoEnrollmentFlow->field('match_policy',

array('CoEnrollmentFlow.id' => $enrollmentFlowID));
@@ -103,9 +103,23 @@

array('CoEnrollmentFlow.id' => $enrollmentFlowID));

if($authzLevel == EnrollmentAuthzEnum::None) {
- // Not really clear where to send a self-enrollment person...
- $this->Session->setFlash(_txt('rs.pt.create.self'), '', array(),
'success');
- $this->redirect("/");
+ // Figure out where to redirect the enrollee to
+ $targetUrl =
$this->CoPetition->CoEnrollmentFlow->field('redirect_on_submit',
+
array('CoEnrollmentFlow.id' => $enrollmentFlowID));
+
+ if(!$targetUrl || $targetUrl == "") {
+ // Default redirect is to /, which isn't really a great target
+
+ $this->Session->setFlash(_txt('rs.pt.create.self'), '',
array(), 'success');
+ $targetUrl = "/";
+ }
+ // else we suppress the flash message, since it may not make
sense in context
+ // or may appear "randomly" (eg: if the targetUrl is outside the
Cake framework)
+
+ // Store the CO Petition ID in the session, so the target can
pick it up if desired
+ $this->Session->write('CoPetition.id', $petitionId);
+
+ $this->redirect($targetUrl);
} elseif($authnReq && $matchPolicy ==
EnrollmentMatchPolicyEnum::Self) {
// Clear any session for account linking
$this->Session->setFlash(_txt('rs.pt.login'), '', array(),
'success');

Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-10-07 20:05:43 UTC (rev 615)
+++ registry/trunk/app/Lib/lang.php 2013-10-08 20:56:20 UTC (rev 616)
@@ -533,6 +533,10 @@
'fd.ef.pool.off.warn' => 'Disabling pooling will duplicate any
organizational identities used by more than one CO (when you click Save).
This operation cannot be undone.',
'fd.ef.px' => 'Provisioning Executable',
'fd.ef.px.desc' => 'Executable to call to initiate user provisioning',
+ 'fd.ef.rd.confirm' => 'Confirmation Redirect URL',
+ 'fd.ef.rd.confirm.desc' => 'URL to redirect to after the email address
associated with the Petition is confirmed. Leave blank for account linking
enrollment.',
+ 'fd.ef.rd.submit' => 'Submission Redirect URL',
+ 'fd.ef.rd.submit.desc' => 'URL to redirect to after Petition is submitted
by someone who is not already in the CO.',
'fd.ef.saml' => 'Enable SAML Attribute Extraction',
'fd.ef.saml.desc' => 'If the enrollee is authenticated via a SAML IdP with
attributes released, examine the SAML assertion for authoritative attributes',
'fd.ef.sea' => 'Require Authentication For Self Enrollment',

Modified: registry/trunk/app/Model/CoEnrollmentFlow.php
===================================================================
--- registry/trunk/app/Model/CoEnrollmentFlow.php 2013-10-07 20:05:43
UTC (rev 615)
+++ registry/trunk/app/Model/CoEnrollmentFlow.php 2013-10-08 20:56:20
UTC (rev 616)
@@ -158,6 +158,16 @@
'required' => false,
'allowEmpty' => true
),
+ 'redirect_on_submit' => array(
+ 'rule' => array('url', true),
+ 'required' => false,
+ 'allowEmpty' => true
+ ),
+ 'redirect_on_confirm' => array(
+ 'rule' => array('url', true),
+ 'required' => false,
+ 'allowEmpty' => true
+ ),
'status' => array(
'rule' => array('inList', array(StatusEnum::Active,
StatusEnum::Suspended))

Modified: registry/trunk/app/View/CoEnrollmentFlows/fields.inc
===================================================================
--- registry/trunk/app/View/CoEnrollmentFlows/fields.inc 2013-10-07
20:05:43 UTC (rev 615)
+++ registry/trunk/app/View/CoEnrollmentFlows/fields.inc 2013-10-08
20:56:20 UTC (rev 616)
@@ -410,6 +410,26 @@
:
Sanitize::html($co_enrollment_flows[0]['CoEnrollmentFlow']['introduction_text']));
?>
</td>
</tr>
+ <tr class="line2">
+ <td>
+ <b><?php print _txt('fd.ef.rd.submit'); ?></b><br />
+ <font class="desc"><?php print _txt('fd.ef.rd.submit.desc');
?></font>
+ </td>
+ <td>
+ <?php print ($e
+ ? $this->Form->input('redirect_on_submit', array('size'
=> 60))
+ :
Sanitize::html($co_enrollment_flows[0]['CoEnrollmentFlow']['redirect_on_submit']));
?>
+ </td>
+ <tr class="line1">
+ <td>
+ <b><?php print _txt('fd.ef.rd.confirm'); ?></b><br />
+ <font class="desc"><?php print _txt('fd.ef.rd.confirm.desc');
?></font>
+ </td>
+ <td>
+ <?php print ($e
+ ? $this->Form->input('redirect_on_confirm',
array('size' => 60))
+ :
Sanitize::html($co_enrollment_flows[0]['CoEnrollmentFlow']['redirect_on_confirm']));
?>
+ </td>
</tbody>
</table>
<?php



  • [comanage-dev] r616 - in registry/trunk/app: Config/Schema Controller Lib Model View/CoEnrollmentFlows, svnlog, 10/08/2013

Archive powered by MHonArc 2.6.16.

Top of Page