Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: VOL-5664 welcome page now appears for external users to agree terms and conditions #419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ilindsay
Copy link
Contributor

Description

Welcome page now appears for external users to agree terms and conditions.

In terms of the login controller I've done enough to get the tests working, but the tests for that as a whole are awful and don't really test anything properly. We need to replace them rather than add to them.

Related issue: VOL-5664

@ilindsay ilindsay requested review from fibble and a team as code owners October 29, 2024 09:23

public function agreeTermsAndConditions(): void
{
$this->termsAgreed = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with other mutable operations on this class, I feel we should return $this;. Means we can retain/have a fluent interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, I'll change it

@@ -32,6 +32,10 @@ public function indexAction()
throw new \Exception('Unable to retrieve identity');
}

if (!$identity->getUserData()['termsAgreed']) {
Copy link
Contributor

@jerotire jerotire Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be done by a listener/middleware instead (or in addition to)? This can easliy be circumvented. Meaning users could potentially be using the service without explicitly agreeing to the terms of service. At least with the middleware approach, we intercept all requests from a new user until they have explicitly agreed to the terms.

*
* @ORM\Column(type="boolean", name="terms_agreed", nullable=false, options={"default": 0})
*/
protected $termsAgreed = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker at this stage, but there was a conversation with Kab a while back, and an idea was to have this is a DateTime/Timestamp. Then opens possibbility in future for the business to update the terms of service (say via some content mangement on internal), without having to set all the users back to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I was in on that, if so I can't remember. But either way, what you suggest makes a lot of sense, and would be better all round. It'd require a few changes of course, including to ETL patch, so I'll check with Kab and see how bothered he his about it.

$consultantUser = $this->getRepo()->fetchById($this->result->getId('user'));
$operatorTcRole = $this->getRepo('Role')->fetchByRole(RoleEntity::ROLE_OPERATOR_TC);
$consultantUser->setRoles(new ArrayCollection([$operatorTcRole]));

//the consultant has already accepted terms and conditions
$consultantUser->agreeTermsAndConditions();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need something similar for Operator Administrator (standard/existing create user command).. If they sign up for their own account, they too will have already ticked the terms of service checkbox.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean - I'll have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants