Page MenuHomePhabricator

Legalpad - add policy rule for legalpad document signatures
ClosedPublic

Authored by btrahan on Jan 15 2014, 10:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 25, 2:15 PM
Unknown Object (File)
Tue, Dec 17, 8:50 AM
Unknown Object (File)
Thu, Dec 12, 6:06 AM
Unknown Object (File)
Thu, Dec 12, 4:33 AM
Unknown Object (File)
Sun, Dec 8, 9:29 PM
Unknown Object (File)
Sat, Dec 7, 11:32 AM
Unknown Object (File)
Fri, Nov 29, 3:22 PM
Unknown Object (File)
Nov 25 2024, 9:18 AM

Details

Reviewers
epriestley
Maniphest Tasks
Restricted Maniphest Task
Commits
Restricted Diffusion Commit
rPd740374cca7a: Legalpad - add policy rule for legalpad document signatures
Summary

Ref T3116. This creates a policy rule where you can require a signature on a given legalpad document.

NOTE: signatures must be for the *latest* document version.
Test Plan

made a task have a custom policy requiring a legalpad signature. verified non-signers were locked out.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

src/applications/policy/rule/PhabricatorPolicyRuleLegalpadSignature.php
25

there's a few keys on this table, but the one with document phid is currently

document phid, document version, signer phid

I guess I could (and probably should) re-jigger this so document version is the 3rd value. I think queries on document phid and signer phid (with no version) will be helpful so we can say things lke "you signed a previous version of this document and must sign again" while still getting the really fast 3 column query.

Neat!

src/applications/policy/rule/PhabricatorPolicyRuleLegalpadSignature.php
21–22

Maybe we should bundle a needViewerSignatures() into this, seems like we must be doing similar queries elsewhere (or could benefit from doing them)?

25

If this was part of the DocumentQuery it could at least add a ... AND documentPHID IN (%Ls) clause to get most of the benefit of the key.

Oh, one thought: this rule/logic should probably be AND, not OR. That is, it seems reasonable to want to say "You have to sign the Invention Assignment Agreement and the Contracting Agreement".

btrahan updated this revision to Unknown Object (????).Jan 16 2014, 12:19 AM
  • re-jigger the key
  • add "withSignerPHIDs" to query class. this filters out documents that don't have the full set of signer phids from the result set
  • use "withSignerPHIDs" in the policy rule object
  • update a query on the "sign" controller to specify key columns in proper order

oh yeah, also made it "AND" and not "OR"

src/applications/legalpad/query/LegalpadDocumentQuery.php
90

gotta add something to check for versions matching, whoops

btrahan updated this revision to Unknown Object (????).Jan 16 2014, 12:44 AM

fix the document version thing and this generally not actually working (I got "lucky" on my re-factor at first and my quick tests were passing and they should not have been)

re-tested extensively by toggling the custom policy between various legalpad documents (1 and N) and verifying proper access or lack of access