Skip to content
  • epriestley's avatar
    Provide core policy support for Spaces · c1c897b9
    epriestley authored
    Summary:
    Ref T8424. No UI or interesting behavior yet, but integrates Spaces checks:
    
      - `PolicyFilter` now checks Spaces.
      - `PolicyAwareQuery` now automatically adds Spaces constraints.
    
    There's one interesting design decision here: **spaces are stronger than automatic capabilities**. That means that you can't see a task in a space you don't have permission to access, //even if you are the owner//.
    
    I //think// this is desirable. Particularly, we need to do this in order to exclude objects at the query level, which potentially makes policy filtering for spaces hugely more efficient. I also like Spaces being very strong, conceptually.
    
    It's possible that we might want to change this; this would reduce our access to optimizations but might be a little friendlier or make more sense to users later on.
    
    For now, at least, I'm pursuing the more aggressive line. If we stick with this, we probably need to make some additional UI affordances (e.g., show when an owner can't see a task).
    
    This also means that you get a hard 404 instead of a policy exception when you try to access something in a space you can't see. I'd slightly prefer to show you a policy exception instead, but think this is generally a reasonable tradeoff to get the high-performance filtering at the Query layer.
    
    Test Plan:
      - Added and executed unit tests.
      - Put objects in spaces and viewed them with multiple users.
      - Made the default space visible/invisible, viewed objects.
      - Checked the services panel and saw `spacePHID` constraints.
      - Verified that this adds only one query to each page.
    
    Reviewers: btrahan, chad
    
    Reviewed By: btrahan
    
    Subscribers: chad, epriestley
    
    Maniphest Tasks: T8424
    
    Differential Revision: https://secure.phabricator.com/D13156
    c1c897b9