Homec4science

Fix some file policy issues and add a "Query Workspace"

Authored by epriestley <git@epriestley.com> on Oct 14 2013, 23:36.

Description

Fix some file policy issues and add a "Query Workspace"

Summary:
Ref T603. Several issues here:

  1. Currently, FileQuery does not actually respect object attachment edges when doing policy checks. Everything else works fine, but this was missing an array_keys().
  2. Once that's fixed, we hit a bunch of recursion issues. For example, when loading a User we load the profile picture, and then that loads the User, and that loads the profile picture, etc.
  3. Introduce a "Query Workspace", which holds objects we know we've loaded and know we can see but haven't finished filtering and/or attaching data to. This allows subqueries to look up objects instead of querying for them.
    • We can probably generalize this a bit to make a few other queries more efficient. Pholio currently has a similar (but less general) "mock cache". However, it's keyed by ID instead of PHID so it's not easy to reuse this right now.

This is a bit complex for the problem being solved, but I think it's the cleanest approach and I believe the primitive will be useful in the future.

Test Plan: Looked at pastes, macros, mocks and projects as a logged-in and logged-out user.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

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

Details

Committed
epriestley <git@epriestley.com>Oct 14 2013, 23:36
Pushed
aubortJan 31 2017, 17:16
Parents
rPH073cb0e78c01: Make PhabricatorPolicyInterface require a getPHID() method
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHc4abf160cc51: Fix some file policy issues and add a "Query Workspace" (authored by epriestley <git@epriestley.com>).Oct 14 2013, 23:36