1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-21 01:38:48 +02:00
phorge-phorge/src/infrastructure
epriestley ded641ae32 Add basic per-object privacy policies
Summary:
Provides a basic start for access policies. Objects expose various capabilities, like CAN_VIEW, CAN_EDIT, etc., and set a policy for each capability. We currently implement three policies, PUBLIC (anyone, including logged-out), USERS (any logged-in) and NOONE (nobody). There's also a way to provide automatic capability grants (e.g., the owner of an object can always see it, even if some capability is set to "NOONE"), but I'm not sure how great the implementation feels and it might change.

Most of the code here is providing a primitive for efficient policy-aware list queries. The problem with doing queries naively is that you have to do crazy amounts of filtering, e.g. to show the user page 6, you need to filter at least 600 objects (and likely more) before you can figure out which ones are 500-600 for them. You can't just do "LIMIT 500, 100" because that might have only 50 results, or no results. Instead, the query looks like "WHERE id > last_visible_id", and then we fetch additional pages as necessary to satisfy the request.

The general idea is that we move all data access to Query classes and have them do object filtering. The ID paging primitive allows efficient paging in most cases, and the executeOne() method provides a concise way to do policy checks for edit/view screens.

We'll probably end up with mostly broader policy UIs or configuration-based policies, but there are at least a few cases for per-object privacy (e.g., marking tasks as "Security", and restricting things to the members of projects) so I figured we'd start with a flexible primitive and the simplify it in the UI where we can.

Test Plan: Unit tests, played around in the UI with various policy settings.

Reviewers: btrahan, vrana, jungejason

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D2210
2012-04-14 10:13:29 -07:00
..
__tests__ Add test to check all symbols can be loaded 2011-10-20 16:43:13 -07:00
celerity Use Celerity to version all static resources 2012-04-08 10:07:51 -07:00
daemon Replace leading double underscore in function names by single underscore 2012-04-03 18:55:52 -07:00
diff Fix missing inline comments issue 2012-04-07 14:05:52 -07:00
edges Allow Commits to be attached to Tasks using edges 2012-04-04 17:34:25 -07:00
env Unify links to www.phabricator.com and phabricator.com 2012-04-09 14:32:03 -07:00
events Add "final" to (almost) everything else 2012-03-13 16:21:04 -07:00
javelin Avoid sending CSRF token in GET and external forms 2012-02-03 10:58:51 -08:00
lint Fix PhabricatorJavelinLinter regex issue caused by D2023 2012-03-26 16:10:05 -07:00
markup/remarkup/markuprule PhabricatorSlug 2012-04-10 14:18:20 -07:00
query Add basic per-object privacy policies 2012-04-14 10:13:29 -07:00
setup Properly detect InnoDB setups which are "NO" or "DISABLED" 2012-04-12 13:44:19 -07:00
testing/testcase Add "final" to (almost) everything else 2012-03-13 16:21:04 -07:00
util PhabricatorSlug 2012-04-10 14:18:20 -07:00