diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php index f9537c48da..2b81af6555 100644 --- a/src/applications/conduit/method/ConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitAPIMethod.php @@ -25,7 +25,7 @@ abstract class ConduitAPIMethod /** * This is mostly for compatibility with - * @{class:AphrontCursorPagedPolicyAwareQuery}. + * @{class:PhabricatorCursorPagedPolicyAwareQuery}. */ public function getID() { return $this->getAPIMethodName(); @@ -166,6 +166,10 @@ abstract class ConduitAPIMethod /* -( PhabricatorPolicyInterface )----------------------------------------- */ + public function getPHID() { + return null; + } + public function getCapabilities() { return array( PhabricatorPolicyCapability::CAN_VIEW, diff --git a/src/applications/config/storage/PhabricatorConfigEntry.php b/src/applications/config/storage/PhabricatorConfigEntry.php index fa0a302db7..6401b0fd62 100644 --- a/src/applications/config/storage/PhabricatorConfigEntry.php +++ b/src/applications/config/storage/PhabricatorConfigEntry.php @@ -3,8 +3,6 @@ final class PhabricatorConfigEntry extends PhabricatorConfigEntryDAO implements PhabricatorPolicyInterface { - protected $id; - protected $phid; protected $namespace; protected $configKey; protected $value; diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php index fd4188e070..3e632fec27 100644 --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -6,8 +6,6 @@ final class ConpherenceThread extends ConpherenceDAO implements PhabricatorPolicyInterface { - protected $id; - protected $phid; protected $title; protected $messageCount; protected $recentParticipantPHIDs = array(); diff --git a/src/applications/countdown/storage/PhabricatorCountdown.php b/src/applications/countdown/storage/PhabricatorCountdown.php index 551c2c848c..19a9227bca 100644 --- a/src/applications/countdown/storage/PhabricatorCountdown.php +++ b/src/applications/countdown/storage/PhabricatorCountdown.php @@ -7,8 +7,6 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO implements PhabricatorPolicyInterface { - protected $id; - protected $phid; protected $title; protected $authorPHID; protected $epoch; diff --git a/src/applications/daemon/storage/PhabricatorDaemonLog.php b/src/applications/daemon/storage/PhabricatorDaemonLog.php index f951df99cc..9f435594fe 100644 --- a/src/applications/daemon/storage/PhabricatorDaemonLog.php +++ b/src/applications/daemon/storage/PhabricatorDaemonLog.php @@ -26,6 +26,9 @@ final class PhabricatorDaemonLog extends PhabricatorDaemonDAO /* -( PhabricatorPolicyInterface )----------------------------------------- */ + public function getPHID() { + return null; + } public function getCapabilities() { return array( diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index 3e12ad9e28..1600b0b201 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -13,7 +13,6 @@ final class DifferentialRevision extends DifferentialDAO protected $summary = ''; protected $testPlan = ''; - protected $phid; protected $authorPHID; protected $lastReviewerPHID; diff --git a/src/applications/diviner/storage/DivinerLiveBook.php b/src/applications/diviner/storage/DivinerLiveBook.php index 70affac00c..9099af58d1 100644 --- a/src/applications/diviner/storage/DivinerLiveBook.php +++ b/src/applications/diviner/storage/DivinerLiveBook.php @@ -3,7 +3,6 @@ final class DivinerLiveBook extends DivinerDAO implements PhabricatorPolicyInterface { - protected $phid; protected $name; protected $viewPolicy; protected $configurationData = array(); diff --git a/src/applications/diviner/storage/DivinerLiveSymbol.php b/src/applications/diviner/storage/DivinerLiveSymbol.php index f2de0d0974..2e873808ab 100644 --- a/src/applications/diviner/storage/DivinerLiveSymbol.php +++ b/src/applications/diviner/storage/DivinerLiveSymbol.php @@ -3,7 +3,6 @@ final class DivinerLiveSymbol extends DivinerDAO implements PhabricatorPolicyInterface, PhabricatorMarkupInterface { - protected $phid; protected $bookPHID; protected $context; protected $type; diff --git a/src/applications/feed/story/PhabricatorFeedStory.php b/src/applications/feed/story/PhabricatorFeedStory.php index eb6b928866..69fdf7c02c 100644 --- a/src/applications/feed/story/PhabricatorFeedStory.php +++ b/src/applications/feed/story/PhabricatorFeedStory.php @@ -283,6 +283,9 @@ abstract class PhabricatorFeedStory implements PhabricatorPolicyInterface { /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ + public function getPHID() { + return null; + } /** * @task policy diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index fdd2a0641f..51e2a55fca 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -14,7 +14,6 @@ final class PhabricatorFile extends PhabricatorFileDAO const METADATA_IMAGE_WIDTH = 'width'; const METADATA_IMAGE_HEIGHT = 'height'; - protected $phid; protected $name; protected $mimeType; protected $byteSize; diff --git a/src/applications/herald/storage/transcript/HeraldTranscript.php b/src/applications/herald/storage/transcript/HeraldTranscript.php index 8b04a8fcc9..be35b9ee02 100644 --- a/src/applications/herald/storage/transcript/HeraldTranscript.php +++ b/src/applications/herald/storage/transcript/HeraldTranscript.php @@ -3,9 +3,6 @@ final class HeraldTranscript extends HeraldDAO implements PhabricatorPolicyInterface { - protected $id; - protected $phid; - protected $objectTranscript; protected $ruleTranscripts = array(); protected $conditionTranscripts = array(); diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php index 45bdbefc87..1b1764acc0 100644 --- a/src/applications/legalpad/storage/LegalpadDocument.php +++ b/src/applications/legalpad/storage/LegalpadDocument.php @@ -9,7 +9,6 @@ final class LegalpadDocument extends LegalpadDAO PhabricatorSubscribableInterface, PhabricatorApplicationTransactionInterface { - protected $phid; protected $title; protected $contributorCount; protected $recentContributorPHIDs = array(); diff --git a/src/applications/macro/storage/PhabricatorFileImageMacro.php b/src/applications/macro/storage/PhabricatorFileImageMacro.php index 272d5abdd0..dab1ac59f3 100644 --- a/src/applications/macro/storage/PhabricatorFileImageMacro.php +++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php @@ -8,7 +8,6 @@ final class PhabricatorFileImageMacro extends PhabricatorFileDAO protected $authorPHID; protected $filePHID; - protected $phid; protected $name; protected $isDisabled = 0; protected $audioPHID; diff --git a/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php b/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php index 2770a93b30..b24ca55185 100644 --- a/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php +++ b/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php @@ -4,7 +4,6 @@ final class PhabricatorMetaMTAMailingList extends PhabricatorMetaMTADAO implements PhabricatorPolicyInterface { protected $name; - protected $phid; protected $email; protected $uri; diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index 171f504b7b..3309f467a9 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -10,7 +10,6 @@ final class ManiphestTask extends ManiphestDAO const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; - protected $phid; protected $authorPHID; protected $ownerPHID; protected $ccPHIDs = array(); diff --git a/src/applications/owners/storage/PhabricatorOwnersPackage.php b/src/applications/owners/storage/PhabricatorOwnersPackage.php index f4132aa3b1..c784a1a224 100644 --- a/src/applications/owners/storage/PhabricatorOwnersPackage.php +++ b/src/applications/owners/storage/PhabricatorOwnersPackage.php @@ -3,7 +3,6 @@ final class PhabricatorOwnersPackage extends PhabricatorOwnersDAO implements PhabricatorPolicyInterface { - protected $phid; protected $name; protected $originalName; protected $auditingEnabled; diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php index 25678e008f..4bb560ee13 100644 --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -9,7 +9,6 @@ final class PhabricatorPaste extends PhabricatorPasteDAO PhabricatorTokenReceiverInterface, PhabricatorPolicyInterface { - protected $phid; protected $title; protected $authorPHID; protected $filePHID; diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index cf6942fb62..a0e0552635 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -11,7 +11,6 @@ final class PhabricatorUser const NAMETOKEN_TABLE = 'user_nametoken'; const MAXIMUM_USERNAME_LENGTH = 64; - protected $phid; protected $userName; protected $realName; protected $sex; diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php index 9270843d5c..2a5ce6832c 100644 --- a/src/applications/phame/storage/PhameBlog.php +++ b/src/applications/phame/storage/PhameBlog.php @@ -10,8 +10,6 @@ final class PhameBlog extends PhameDAO const SKIN_DEFAULT = 'oblivious'; - protected $id; - protected $phid; protected $name; protected $description; protected $domain; diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index fc3b1d1721..5ae396f4c8 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -15,8 +15,6 @@ final class PhamePost extends PhameDAO const VISIBILITY_DRAFT = 0; const VISIBILITY_PUBLISHED = 1; - protected $id; - protected $phid; protected $bloggerPHID; protected $title; protected $phameTitle; diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php index 24e3e7bfa7..4be1043ff9 100644 --- a/src/applications/phriction/storage/PhrictionDocument.php +++ b/src/applications/phriction/storage/PhrictionDocument.php @@ -9,8 +9,6 @@ final class PhrictionDocument extends PhrictionDAO PhabricatorSubscribableInterface, PhabricatorTokenReceiverInterface { - protected $id; - protected $phid; protected $slug; protected $depth; protected $contentID; diff --git a/src/applications/policy/__tests__/PhabricatorPolicyTestObject.php b/src/applications/policy/__tests__/PhabricatorPolicyTestObject.php index b010f88d01..041b612757 100644 --- a/src/applications/policy/__tests__/PhabricatorPolicyTestObject.php +++ b/src/applications/policy/__tests__/PhabricatorPolicyTestObject.php @@ -10,6 +10,10 @@ final class PhabricatorPolicyTestObject private $policies = array(); private $automaticCapabilities = array(); + public function getPHID() { + return null; + } + public function getCapabilities() { return $this->capabilities; } diff --git a/src/applications/policy/filter/PhabricatorPolicyFilter.php b/src/applications/policy/filter/PhabricatorPolicyFilter.php index b962049d71..cdaf8af816 100644 --- a/src/applications/policy/filter/PhabricatorPolicyFilter.php +++ b/src/applications/policy/filter/PhabricatorPolicyFilter.php @@ -282,19 +282,9 @@ final class PhabricatorPolicyFilter { $details = array_filter(array_merge(array($more), (array)$exceptions)); - // NOTE: Not every policy object has a PHID, just pull an arbitrary - // "unknown object" handle if this fails. We're just using this to provide - // a better error message if we can. - - $phid = '?'; - if (($object instanceof PhabricatorLiskDAO) || - (method_exists($object, 'getPHID'))) { - try { - $phid = $object->getPHID(); - } catch (Exception $ignored) { - // Ignore. - } - } + // NOTE: Not every type of policy object has a real PHID; just load an + // empty handle if a real PHID isn't available. + $phid = nonempty($object->getPHID(), PhabricatorPHIDConstants::PHID_VOID); $handle = id(new PhabricatorHandleQuery()) ->setViewer($this->viewer) diff --git a/src/applications/policy/interface/PhabricatorPolicyInterface.php b/src/applications/policy/interface/PhabricatorPolicyInterface.php index 73905c7f63..1cab9c29e9 100644 --- a/src/applications/policy/interface/PhabricatorPolicyInterface.php +++ b/src/applications/policy/interface/PhabricatorPolicyInterface.php @@ -2,6 +2,7 @@ interface PhabricatorPolicyInterface { + public function getPHID(); public function getCapabilities(); public function getPolicy($capability); public function hasAutomaticCapability($capability, PhabricatorUser $viewer); diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index 4d3ec45b6d..0da1c24151 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -4,7 +4,6 @@ final class PhabricatorProject extends PhabricatorProjectDAO implements PhabricatorPolicyInterface { protected $name; - protected $phid; protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; protected $authorPHID; protected $subprojectPHIDs = array(); diff --git a/src/applications/releeph/storage/ReleephBranch.php b/src/applications/releeph/storage/ReleephBranch.php index 799e658b2c..6ebda21414 100644 --- a/src/applications/releeph/storage/ReleephBranch.php +++ b/src/applications/releeph/storage/ReleephBranch.php @@ -3,7 +3,6 @@ final class ReleephBranch extends ReleephDAO implements PhabricatorPolicyInterface { - protected $phid; protected $releephProjectID; protected $isActive; protected $createdByUserPHID; diff --git a/src/applications/releeph/storage/ReleephProject.php b/src/applications/releeph/storage/ReleephProject.php index eed3cca7a9..acd2c2f788 100644 --- a/src/applications/releeph/storage/ReleephProject.php +++ b/src/applications/releeph/storage/ReleephProject.php @@ -10,7 +10,6 @@ final class ReleephProject extends ReleephDAO const COMMIT_AUTHOR_FROM_DIFF = 'commit-author-is-from-diff'; const COMMIT_AUTHOR_REQUESTOR = 'commit-author-is-requestor'; - protected $phid; protected $name; // Specifying the place to pick from is a requirement for svn, though not diff --git a/src/applications/releeph/storage/ReleephRequest.php b/src/applications/releeph/storage/ReleephRequest.php index fd2486055b..a46e365aa2 100644 --- a/src/applications/releeph/storage/ReleephRequest.php +++ b/src/applications/releeph/storage/ReleephRequest.php @@ -5,7 +5,6 @@ final class ReleephRequest extends ReleephDAO PhabricatorPolicyInterface, PhabricatorCustomFieldInterface { - protected $phid; protected $branchID; protected $requestUserPHID; protected $details = array(); diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index 32782b65d4..46f7db39de 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -25,7 +25,6 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO const TABLE_BADCOMMIT = 'repository_badcommit'; const TABLE_LINTMESSAGE = 'repository_lintmessage'; - protected $phid; protected $name; protected $callsign; protected $uuid; diff --git a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php b/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php index 37ee0f6ebc..444cb10c4a 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php +++ b/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php @@ -8,7 +8,6 @@ final class PhabricatorRepositoryArcanistProject implements PhabricatorPolicyInterface { protected $name; - protected $phid; protected $repositoryID; protected $symbolIndexLanguages = array(); diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php index ad83b8c32e..4755b2f6ee 100644 --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -892,6 +892,11 @@ abstract class LiskDAO { } + public function getPHID() { + return $this->phid; + } + + /** * Test if a property exists. *