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

MLPAB-2318: Support ATTORNEY_OPT_OUT #241

Merged
merged 11 commits into from
Aug 12, 2024
Merged

Conversation

acsauk
Copy link
Contributor

@acsauk acsauk commented Aug 8, 2024

Purpose

Enables MLPAB-2318.

@acsauk acsauk marked this pull request as ready for review August 8, 2024 16:02
@acsauk acsauk requested review from a team as code owners August 8, 2024 16:02
Comment on lines 24 to 29
parts := strings.Split(u.Author, ":users:")
if len(parts) > 1 && parts[1] != "" {
return parts[1]
} else {
return ""
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
parts := strings.Split(u.Author, ":users:")
if len(parts) > 1 && parts[1] != "" {
return parts[1]
} else {
return ""
}
_, after, _ := strings.Cut(u.Author, ":users:")
return after

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tidy 👌

return AttorneyOptOut{}, []shared.FieldError{{Source: "/changes", Detail: "expected empty"}}
}

if update.AuthorUID() == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

if this were changed to pass the change specifying which attorney is opting-out it might allow Sirius to use it too? (and also I'm starting to wonder if having empty updates is a bad pattern)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I would prefer that you have to specify the UID, and iif the JWT comes from MRLPA then the UID must match. That would give us more flexibility for Sirius and maintain a security check.

Comment on lines 19 to 20
// TODO Check if status correct
attorney.Status = shared.AttorneyStatusRemoved
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense to stick with removed for now. If we find a need for something more particular then we can add that later (either a new status, or a new "reason for removal"-type field)

Comment on lines 23 to 24
switch len(lpa.Attorneys) {
case 1, 2:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be checking that there are 1 or 2 active attorneys? In case they've already been removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yeah, and will also need to take into account trust corporations and replacements

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call on the attorney status, I'll update.

I was planning on handling replacements and trust corps in a separate ticket as the logic gets a bit spicy then but will double check if there's a ticket in the backlog and add one if not.

enforce URN format, match author and subject UI when makeregister and validate on active attorneys

uidErrors := validate.All(
validate.UUID("/update/author/uid", author.UID),
validate.UUID("/update/subject", update.Subject),
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be /subject to match the JSON given, and I think maybe just ignore validation on author.UID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep makes sense 👍


attorneysCount := len(lpa.ActiveAttorneys()) + len(lpa.ActiveTrustCorporations())
switch attorneysCount {
case 0, 1:
Copy link
Contributor Author

@acsauk acsauk Aug 9, 2024

Choose a reason for hiding this comment

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

I'm now questioning the logic here myself 😂 would having one remaining attorney invalidate the LPA in all cases or only if its the jointly or jointly for some...?

Copy link
Contributor

Choose a reason for hiding this comment

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

do you have a link to where this logic came from? (I would've thought a single attorney is fine for "jointly and severally" if the other attorneys can be removed)

Copy link
Contributor Author

@acsauk acsauk Aug 12, 2024

Choose a reason for hiding this comment

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

That's the problem, I thought I could rely on the delete attorney MRLPA logic but as its pre-signing we're not focused on validity there.

I've asked Abbi to add this topic to collab time tomorrow to discuss the various scenarios. I'll update this and we can tweak if needed after tomorrow's discussion.

Comment on lines 299 to 301
subject:
type: string
format: uuid
Copy link
Contributor

@gregtyler gregtyler Aug 12, 2024

Choose a reason for hiding this comment

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

The original intent of this was that you would do:

{"changes": [
  {
    "key": "/attorneys/5373cdf6-c74c-4e1c-a126-e7aa60afb72d/status",
    "old": "active",
    "new": "removed"
  }
]}

Which was particularly thinking about editing multiple fields at once (e.g. scanning corrections or changing someone's contact details).

It feels like this pattern isn't working for us in a few places now. I wonder if we should allow each update type to have its own shape?

@acsauk acsauk merged commit daa60de into main Aug 12, 2024
23 checks passed
@acsauk acsauk deleted the MLPAB-2318-support-attorney-opt-out branch August 12, 2024 15:40
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.

3 participants