HomePhabricator

Require several advanced postgraduate degrees to understand object policies

Tags
None
Referenced Files
F1912861: Screen Shot 2016-11-09 at 12.02.59 PM.png
Nov 9 2016, 11:05 PM
F1912862: Screen Shot 2016-11-09 at 12.03.02 PM.png
Nov 9 2016, 11:05 PM
F1912860: Screen Shot 2016-11-09 at 10.29.44 AM.png
Nov 9 2016, 11:05 PM
F1912863: Screen Shot 2016-11-09 at 12.02.41 PM.png
Nov 9 2016, 11:05 PM
Subscribers
None

Description

Require several advanced postgraduate degrees to understand object policies

Summary:
Fixes T11836. See some prior discussion in T8376#120613.

The policy hint in headers in the UI is not exhaustive, and can not reasonably be exhaustive. For example, on a revision, it may say "All Users", but really mean "All users who can see the space this object is in and the repository it belongs to, plus the revision author and reviewers".

These rules are explained if you click (and, often, in the documentation), but "All Users" is still at least somewhat misleading.

I don't think there's any perfect solution here that balances the needs of both new and experienced users perfectly, but this change tries to do a bit better about avoiding cases where we say something very open (like "All Users") when the real policy is not very open.

Specifically, I've made these changes to the header:

  • Spaces are now listed in the tag, so it will say (S3 > All Users) instead of (All Users). They're already listed in the header, this just makes it more explicit that Spaces are a policy container and part of the view policy.
  • Extended policy objects are now listed in the tag, so it will say (S3 > rARC > All Users) for a revision in the Arcanist repository which is also in Space 3.
  • Objects can now provide a "Policy Codex", which is an object that represents a rulebook of more sophisticated policy descriptions. This codex can replace the tag with something else.
    • Imported calendar events now say "Uses Import Policy" instead of, e.g., "All Users".

I've made these changes to the policy dialog:

  • Split it into more visually separate sections.
  • Added an explicit section for extended policies ("You must also have access to these other objects: ...").
  • Broken the object policy rules into a "Special Rules" section (for rules like "you can only see a revision if you can see the repository it is part of") and an "Object Policy" section (for the actual object policy).
  • Tried to make it a little more readable?
  • The new policy dialogs are great to curl up with in front of a fire with a nice cup of cocoa.

I've made these changes to infrastructure:

  • Implementing PhabricatorPolicyInterface no longer requires you to implement describeAutomaticCapability().
  • Instead, implement PhabricatorPolicyCodexInterface and return a PhabricatorPolicyCodex object.
  • This "codex" is a policy rulebook which can set all the policy icons, labels, colors, rules, etc., to properly explain complex policies.
  • Broadly, the old method was usually either not useful (most objects have no special rules) or not powerful enough (objects with special rules often need to do more in order to explain them).

Test Plan:

Screen Shot 2016-11-09 at 10.29.44 AM.png (99×165 px, 8 KB)

Screen Shot 2016-11-09 at 12.02.59 PM.png (214×395 px, 29 KB)

Screen Shot 2016-11-09 at 12.03.02 PM.png (837×932 px, 108 KB)

Screen Shot 2016-11-09 at 12.02.41 PM.png (668×927 px, 84 KB)

Reviewers: chad

Reviewed By: chad

Subscribers: avivey

Maniphest Tasks: T11836

Differential Revision: https://secure.phabricator.com/D16830