-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of Mostly Static Pages (CFM-62), InvitationAccepter (C…
…FM-334) and UpsertTrait (CFM-423)
- Loading branch information
Showing
46 changed files
with
2,024 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
app/plugins/CoreEnroller/src/Controller/InvitationAcceptersController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<?php | ||
/** | ||
* COmanage Registry Basic Invitation Accepters Controller | ||
* | ||
* Portions licensed to the University Corporation for Advanced Internet | ||
* Development, Inc. ("UCAID") under one or more contributor license agreements. | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* UCAID licenses this file to you under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @link https://www.internet2.edu/comanage COmanage Project | ||
* @package registry-plugins | ||
* @since COmanage Registry v5.1.0 | ||
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreEnroller\Controller; | ||
|
||
use Cake\ORM\TableRegistry; | ||
use App\Controller\StandardEnrollerController; | ||
use App\Lib\Enum\PetitionActionEnum; | ||
|
||
class InvitationAcceptersController extends StandardEnrollerController { | ||
public $paginate = [ | ||
'order' => [ | ||
'InvitationAccepters.id' => 'asc' | ||
] | ||
]; | ||
|
||
/** | ||
* Dispatch an Enrollment Flow Step. | ||
* | ||
* @since COmanage Registry v5.1.0 | ||
* @param string $id Invitation Accepter ID | ||
*/ | ||
|
||
public function dispatch(string $id) { | ||
$petition = $this->getPetition(); | ||
|
||
$cfg = $this->InvitationAccepters->get($id); | ||
|
||
$this->set('vv_config', $cfg); | ||
|
||
$PetitionAcceptances = TableRegistry::getTableLocator()->get('CoreEnroller.PetitionAcceptances'); | ||
|
||
$pa = $PetitionAcceptances->find()->where(['petition_id' => $petition->id])->first(); | ||
|
||
$this->set('vv_pa', $pa); | ||
|
||
if($this->request->is(['post', 'put'])) { | ||
$data = $this->request->getData(); | ||
|
||
$accepted = (bool)$data['accepted']; | ||
|
||
try { | ||
$PetitionAcceptances->processReply( | ||
$petition->id, | ||
$cfg->enrollment_flow_step_id, | ||
$accepted | ||
); | ||
|
||
if($accepted) { | ||
// On acceptance, indicate the step is completed and generate a redirect | ||
// to the next step | ||
|
||
$link = $this->getPrimaryLink(true); | ||
|
||
return $this->finishStep( | ||
enrollmentFlowStepId: $link->value, | ||
petitionId: $petition->id, | ||
comment: __d('core_enroller', ($accepted ? 'result.accept.accepted' : 'result.accept.declined')) | ||
); | ||
} else { | ||
// On decline, set a flash message and redirect to the petition complete landing | ||
$this->Flash->success(__d('core_enroller', 'result.accept.declined')); | ||
|
||
$coId = $this->getCOID(); | ||
|
||
return $this->redirect("/$coId/petition-complete"); | ||
} | ||
} | ||
catch(\Exception $e) { | ||
$this->Flash->error($e->getMessage()); | ||
} | ||
} else { | ||
// Record that the invitation was viewed | ||
$PetitionHistoryRecords = TableRegistry::getTableLocator()->get('PetitionHistoryRecords'); | ||
|
||
$PetitionHistoryRecords->record( | ||
petitionId: $petition->id, | ||
enrollmentFlowStepId: $cfg->enrollment_flow_step_id, | ||
action: PetitionActionEnum::InvitationViewed, | ||
comment: __d('result', 'Petitions.viewed.inv') | ||
// actorPersonId | ||
); | ||
} | ||
|
||
// Fall through and let the form render*/ | ||
|
||
$this->render('/Standard/dispatch'); | ||
} | ||
|
||
/** | ||
* Display information about this Step. | ||
* | ||
* @since COmanage Registry v5.1.0 | ||
* @param string $id Invitation Accepters ID | ||
*/ | ||
|
||
public function display(string $id) { | ||
$petition = $this->getPetition(); | ||
|
||
$PetitionAcceptances = TableRegistry::getTableLocator()->get('CoreEnroller.PetitionAcceptances'); | ||
|
||
$this->set('vv_pa', $PetitionAcceptances->find()->where(['petition_id' => $petition->id])->first()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app/plugins/CoreEnroller/src/Model/Entity/PetitionAcceptance.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* COmanage Registry Petition Acceptance Entity | ||
* | ||
* Portions licensed to the University Corporation for Advanced Internet | ||
* Development, Inc. ("UCAID") under one or more contributor license agreements. | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* UCAID licenses this file to you under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @link https://www.internet2.edu/comanage COmanage Project | ||
* @package registry-plugins | ||
* @since COmanage Registry v5.1.0 | ||
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreEnroller\Model\Entity; | ||
|
||
use Cake\ORM\Entity; | ||
|
||
class PetitionAcceptance extends Entity { | ||
/** | ||
* Fields that can be mass assigned using newEntity() or patchEntity(). | ||
* | ||
* Note that when '*' is set to true, this allows all unspecified fields to | ||
* be mass assigned. For security purposes, it is advised to set '*' to false | ||
* (or remove it), and explicitly make individual fields accessible as needed. | ||
* | ||
* @var array<string, bool> | ||
*/ | ||
protected $_accessible = [ | ||
'*' => true, | ||
'id' => false, | ||
'slug' => false, | ||
]; | ||
} |
49 changes: 49 additions & 0 deletions
49
app/plugins/CoreEnroller/src/Model/Entity/PetitionBasicAttributeSet.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* COmanage Registry Petition Basic Attribute Set Entity | ||
* | ||
* Portions licensed to the University Corporation for Advanced Internet | ||
* Development, Inc. ("UCAID") under one or more contributor license agreements. | ||
* See the NOTICE file distributed with this work for additional information | ||
* regarding copyright ownership. | ||
* | ||
* UCAID licenses this file to you under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @link https://www.internet2.edu/comanage COmanage Project | ||
* @package registry-plugins | ||
* @since COmanage Registry v5.1.0 | ||
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CoreEnroller\Model\Entity; | ||
|
||
use Cake\ORM\Entity; | ||
|
||
class PetitionBasicAttributeSet extends Entity { | ||
/** | ||
* Fields that can be mass assigned using newEntity() or patchEntity(). | ||
* | ||
* Note that when '*' is set to true, this allows all unspecified fields to | ||
* be mass assigned. For security purposes, it is advised to set '*' to false | ||
* (or remove it), and explicitly make individual fields accessible as needed. | ||
* | ||
* @var array<string, bool> | ||
*/ | ||
protected $_accessible = [ | ||
'*' => true, | ||
'id' => false, | ||
'slug' => false, | ||
]; | ||
} |
Oops, something went wrong.