Add forms for displaying and gathering consent.

Review Request #9925 — Created May 11, 2018 and submitted

Information

Djblets
release-1.0.x
cdfcfc2...

Reviewers

This introduces a new djblets.privacy.consent.forms module, which
features fields, widgets, and form mixins for prompting for consent.
Along with the rest of the consent functionality, it's now very easy
for applications to offer users options on how to manage their own
personal data.

ConsentRequirementField (and its corresponding widget) displays an
informative field for a single ConsentRequirement. It clearly lists
a summary of the requirement, an optional icon representing it, a
description of the intended usage, and a description of what data would
be sent. Two buttons, "Allow" and "Block," are available to allow usage
of their private data for the feature or to block usage.

MultiConsentRequirementsField wraps multiple
ConsentRequirementFields, one for each requirement provided (or one
for each one registered in the registry). This is intended for forms
that want to offer all (or many) options at once.

ConsentFormMixin can be mixed into other forms, and will construct a
MultiConsentRequirementsField on initialization. It provides a handful
of methods to override for controlling data going into the field, and a
save_consent() method to save and record the choices made.

ConsentConfigPageFormMixin is used for configforms, and provides
default implementations of the methods needed by ConsentFormMixin. It
also automatically handles the saving, and adds a message to display
on the form when saved. This is the easiest way to provide consent
information to users.

Unit tests pass.

Manually and thoroughly tested this form, allowing and blocking
consent for multiple options and testing results. Tested validation
logic and resulting data in the database on success.


Description From Last Updated

Using general comments because image comments are broken on this deploy: For the error case, I feel like the error …

daviddavid

optional?

daviddavid

optional?

daviddavid

list -> list of

daviddavid

I don't think "decorational" is a word

daviddavid
chipx86
david
  1. 
      
  2. Show all issues

    Using general comments because image comments are broken on this deploy:

    For the error case, I feel like the error message is hard to see, and it's also probably hard to know immediately which things still need choices.

    Can we move the error message next to the "Save" button, and then add some kind of callout for each un-chosen item (maybe bold red arrows next to the allow/block actions)?

    1. We have no control over the placement of the error message, unfortunately. Nothing I can do about that. The widget renders the field, not the label or error.

      Completely agree on needing to better point out things that haven't yet been chosen. I'll give that some thought. To unblock Barret and my other changes, I'd like to do this in a separate change.

  3. djblets/privacy/consent/forms.py (Diff revision 1)
     
     
    Show all issues

    optional?

  4. djblets/privacy/consent/forms.py (Diff revision 1)
     
     
    Show all issues

    optional?

  5. djblets/privacy/consent/forms.py (Diff revision 1)
     
     
    Show all issues

    list -> list of

  6. Show all issues

    I don't think "decorational" is a word

    1. It really should be. It's a perfectly cromulent word.

  7. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-1.0.x (ac42d30)