1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 03:02:43 +01:00
phorge-phorge/src/applications/people/storage
epriestley ab4743b216 Improve Phortune policy behavior
Summary:
Currently, PhortuneAccounts have a very open default policy to allow merchants to see and interact with them.

This has the undesirable side effect of leaking their names in too many places, because all users are allowed to load the handles for the accounts. Although this information is not super sensitive, we shouldn't expose it.

I went through about 5 really messy diffs trying to fix this. It's very complicated because there are a lot of objects and many of them are related to PhortuneAccounts, but PhortuneAccounts are not bound to a specific merchant. This lead to a lot of threading viewers and merchants all over the place through the call stack and some really sketchy diffs with OmnipotentUsers that weren't going anywhere good.

This is the cleanest approach I came up with, by far:

  - Introduce the concept of an "Authority", which gives a user more powers as a viewer. For now, since we only have one use case, this is pretty open-ended.
  - When a viewer is acting as a merchant, grant them authority through the merchant.
  - Have Accounts check if the viewer is acting with merchant authority. This lets us easily implement the rule "merchants can see this stuff" without being too broad.

Then update the Subscription view to respect Merchant Authority.

I partially updated the Cart views to respect it. I'll finish this up in a separate diff, but this seemed like a good checkpoint that introduced the concept without too much extra baggage.

This feels pretty good/clean to me, overall, even ignoring the series of horrible messes I made on my way here.

Test Plan:
  - Verified I can see everything I need to as a merchant (modulo un-updated Cart UIs).
  - Verified I can see nothing when acting as a normal user.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11945
2015-03-03 10:38:25 -08:00
..
__tests__ Use "\z" instead of "$" to anchor validating regular expressions 2014-03-13 12:42:41 -07:00
PhabricatorExternalAccount.php Fix visiblity of LiskDAO::getConfiguration() 2015-01-14 06:54:13 +11:00
PhabricatorRegistrationProfile.php New Registration Workflow 2013-06-16 10:13:49 -07:00
PhabricatorUser.php Improve Phortune policy behavior 2015-03-03 10:38:25 -08:00
PhabricatorUserConfiguredCustomFieldStorage.php Various linter fixes. 2014-02-26 12:44:58 -08:00
PhabricatorUserCustomFieldNumericIndex.php Various linter fixes. 2014-02-26 12:44:58 -08:00
PhabricatorUserCustomFieldStringIndex.php Various linter fixes. 2014-02-26 12:44:58 -08:00
PhabricatorUserDAO.php Delete license headers from files 2012-11-05 11:16:51 -08:00
PhabricatorUserEmail.php Fix visiblity of LiskDAO::getConfiguration() 2015-01-14 06:54:13 +11:00
PhabricatorUserLog.php Legalpad - allow for legalpad documents to be required to be signed for using Phabricator 2015-02-12 15:22:56 -08:00
PhabricatorUserProfile.php Fix visiblity of LiskDAO::getConfiguration() 2015-01-14 06:54:13 +11:00
PhabricatorUserSchemaSpec.php Fix various MySQL version issues with new charset stuff 2014-10-29 15:49:29 -07:00
PhabricatorUserTransaction.php Rename PHIDType classes 2014-07-24 08:05:46 +10:00