Homec4science

Add a "Subscribers" object policy

Authored by epriestley <git@epriestley.com> on Jun 14 2015, 00:45.

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

Committed
epriestley <git@epriestley.com>Jun 14 2015, 00:45
Pushed
aubortJan 31 2017, 17:16
Parents
rPH893c7a26c196: Add a "Thread Members" object policy and some unit tests
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH3de3a72dd8c7: Add a "Subscribers" object policy (authored by epriestley <git@epriestley.com>).Jun 14 2015, 00:45