HomePhabricator

Add a "Subscribers" object policy

Description

Add a "Subscribers" object policy

Summary:
Ref T5681. Getting this to work correctly is a bit tricky, mostly because of the policy checks we do prior to applying an edit.

I think I came up with a mostly-reasonable approach, although it's a little bit gross. It uses spl_object_hash() so it shouldn't be able to do anything bad/dangerous (the hints are strictly bound to the hinted object, which is a clone that we destroy moments later).

Test Plan:

  • Added + ran a unit test.
  • Created a task with a "Subscribers" policy with me as a subscriber (without the hint stuff, this isn't possible: since you aren't a subscriber *yet*, you get a "you won't be able to see it" error).
  • Unsubscribed from a task with a "Subscribers" policy, was immediately unable to see it.
  • Created a task with a "subscribers" policy and a project subscriber with/without me as a member (error / success, respectively).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5681

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

Details

Provenance
epriestleyAuthored on
epriestleyPushed on Jun 13 2015, 10:45 PM
Reviewer
btrahan
Differential Revision
D13259: Add a "Subscribers" object policy
Parents
rP893c7a26c196: Add a "Thread Members" object policy and some unit tests
Branches
Unknown
Tags
Unknown
Tasks
T5681: Allow applications to provide custom policy rules