Page MenuHomePhabricator

Allow PolicyRules to serve as "Object Policies"
ClosedPublic

Authored by epriestley on Jun 11 2015, 11:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 17, 9:22 AM
Unknown Object (File)
Sun, Dec 8, 6:56 PM
Unknown Object (File)
Sun, Dec 8, 9:44 AM
Unknown Object (File)
Thu, Dec 5, 12:49 AM
Unknown Object (File)
Thu, Nov 28, 4:56 AM
Unknown Object (File)
Thu, Nov 28, 4:56 AM
Unknown Object (File)
Thu, Nov 28, 4:55 AM
Unknown Object (File)
Thu, Nov 28, 4:44 AM
Subscribers
Tokens
"Mountain of Wealth" token, awarded by joshuaspence."Yellow Medal" token, awarded by btrahan.

Details

Summary

Ref T5681. Ref T8488. This allows policy rules to provide "Object Policies", which are similar to the global/basic policies:

  • They show up directly in the dropdown (you don't have to create a custom rule).
  • They don't need to create or load anything in the database.

To implement one, you just add a couple methods on an existing PolicyRule that let Phabricator know it can work as an object policy rule.

Screen Shot 2015-06-11 at 4.07.46 PM.png (465×333 px, 39 KB)

These rules only show up where they make sense. For example, the "Task Author" rule is only available in Maniphest, and in "Default View Policy" / "Default Edit Policy" of the Application config.

This should make T8488 easier by letting us set the default policies to "Members of Thread", without having to create a dedicated custom policy for every thread.

Test Plan
  • Set tasks to "Task Author" policy.
  • Tried to view them as other users.
  • Viewed transaction change strings.
  • Viewed policy errors.
  • Set them as default policies.
  • Verified they don't leak into other policy controls.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Allow PolicyRules to serve as "Object Policies".
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Jun 11 2015, 11:42 PM
This revision was automatically updated to reflect the committed changes.