-
Notifications
You must be signed in to change notification settings - Fork 4
Improve T&C (and all) mobile rendering (CFM-501) #447
base: develop
Are you sure you want to change the base?
Conversation
|
This PR includes all commits found in #419. This PR adds only one commit, but it was large enough that I didn't want to commingle them. |
Ioannis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
6cc996c to
b25dd03
Compare
| personId: $json['personId'], | ||
| actorPersonId: $json['actorPersonId'], | ||
| personId: (int)$json['personId'], | ||
| actorPersonId: (int)$json['actorPersonId'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this is existing code, but what's to stop somebody from sending a random person ID as either the subject or the actor? The original intent of the /record API was for API Users, not AJAX requests, and API Users are already trusted to make calls on behalf of other users.
We probably need to split recordTAndC into two: one for the "regular" API and one for the AJAX API. The second call can set the Actor Person ID based on the currently authenticated user. Person ID would either (1) be the currently authenticated user, or (2) if the user is an Admin, allow Person ID to be asserted if it is any Person the Actor can manage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this concern. Can we break this issue out into a different ticket independent of this PR since this one doesn't change the existing code (other than to ensure the (int) type is properly cast)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds the record route to the AJAX API, so we can't merge it until this is addressed since doing so will introduce a security issue. I've opened CFM-553 for the API change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // The default mode for CO and platform wide T&Cs is "Explicit Consent". | ||
| // There is no enumeration for this in core, so set the value explicitly to 'EC'. | ||
| $this->set('vv_tandc_mode', 'EC'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is core code referencing a Plugin concept, so we need to fix this.
Presumably the same concept could apply during Review at Login: as a CO Administrator, I might want to set this to Implied Consent to match the behavior of the Enroller Plugin.
Minimally, it seems like TermsAgreer\Lib\Enum\TAndCEnrollmentModeEnum could become a Core Enumeration, perhaps renamed to something like TAndCAgreementModeEnum. The question is whether we also merge it with TAndCLoginModeEnum. While at first glance it seems like we could, the (unknowable) question is what future enhancements might be requested for the Login Review behavior.
We could, for example, imagine a future request for "Require at Login, but not for Administrators", or "Require at Login, but allow the user to Skip twice". So it probably makes sense to keep the two enums as separate concepts, which unfortunately means we probably also need a second CO Setting to control the Explicit / Implied Consent decision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - I will move TermsAgreer\Lib\Enum\TAndCEnrollmentModeEnum to Core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TermsAgreer\Lib\Enum\TAndCEnrollmentModeEnum has been moved to Core TAndCAgreementModeEnum.
e07ad12 to
748c0c8
Compare
|
This PR has been rebased against the latest develop. |
748c0c8 to
a365af2
Compare
|
Rebased against the latest develop. |
…erve database column value
… to record agreements on login (CFM-501)
a365af2 to
1c24f70
Compare
|
This has been rebased against develop, and I believe all issues above have been addressed. |
| @@ -123,7 +123,7 @@ public function initialize(array $config): void { | |||
| // able to record the actor foreign key for audit purposes. | |||
| 'proxy' => ['coAdmin'], | |||
| // 'recordTAndC' is used by ApiV2Controller | |||
| 'recordTAndC' => ['platformAdmin', 'coAdmin'], | |||
| 'recordTAndC' => ['platformAdmin', 'coAdmin', 'coMember'], | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be a problem because it's going to open the Model Specific API to any API user, not just privileged ones. We'll need to split recordTAndC into two separate actions, one for the Model Specific API, and one for the AJAX API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been addressed in 2c4fdd4
| const requests = []; | ||
| $('input.tc-agree-checkbox').each(function(){ | ||
| const status = $(this).data('status'); | ||
| if(status === 'N') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking you shouldn't hardcode the enum value, but do something like
if(status === '<?= TAndCStatusEnum::NotAgreed ?>') {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point - fixed in f0f5894
| 'checked' => !empty($vv_tandc_statuses) && $vv_tandc_statuses[$i]['status'] === 'Y' ? true : false, | ||
| 'data-id' => $tc['id'], | ||
| 'data-status' => !empty($vv_tandc_statuses) && $vv_tandc_statuses[$i]['status'] === 'Y' ? 'Y' : 'N', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, preferable not to hard code the enum values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also fixed in f0f5894
| $('.tc-agree-checkbox').each(function() { | ||
| if(!$(this).prop('checked')) { | ||
| allAgreed = false; | ||
| if(mode == 'EC') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ibid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also also fixed in f0f5894
…ic API, and one for the AJAX API (CFM-501)
| @@ -145,19 +145,14 @@ function (RouteBuilder $builder) { | |||
| ['controller' => 'ApiV2', 'action' => 'generateApiKey', 'model' => 'api_users']) | |||
| ->setPass(['id']) | |||
| ->setPatterns(['id' => '[0-9]+']); | |||
| $builder->post( | |||
| '/terms_and_conditions/record/{id}', | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This route was in here twice (which is why the change may look a little more confusing than it is). The only actual change here is changing the terms_and_conditions/record action from 'recordTAndC' to 'xRecordTAndC'.
No description provided.