private function buildPropertyView(PassphraseCredential $credential, PassphraseCredentialType $type, PhabricatorActionListView $actions) { $viewer = $this->getRequest()->getUser(); $properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($credential)->setActionList($actions); $properties->addProperty(pht('Credential Type'), $type->getCredentialTypeName()); $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $credential); $properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]); $properties->addProperty(pht('Username'), $credential->getUsername()); $used_by_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($credential->getPHID(), PhabricatorEdgeConfig::TYPE_CREDENTIAL_USED_BY_OBJECT); if ($used_by_phids) { $this->loadHandles($used_by_phids); $properties->addProperty(pht('Used By'), $this->renderHandlesForPHIDs($used_by_phids)); } $description = $credential->getDescription(); if (strlen($description)) { $properties->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY); $properties->addTextContent(PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($description), 'default', $viewer)); } return $properties; }
private function buildPropertyView(PassphraseCredential $credential, PassphraseCredentialType $type, PhabricatorActionListView $actions) { $viewer = $this->getRequest()->getUser(); $properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($credential)->setActionList($actions); $properties->addProperty(pht('Credential Type'), $type->getCredentialTypeName()); $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $credential); $properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]); if ($type->shouldRequireUsername()) { $properties->addProperty(pht('Username'), $credential->getUsername()); } $used_by_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($credential->getPHID(), PhabricatorCredentialsUsedByObjectEdgeType::EDGECONST); if ($used_by_phids) { $properties->addProperty(pht('Used By'), $viewer->renderHandleList($used_by_phids)); } $properties->invokeWillRenderEvent(); $description = $credential->getDescription(); if (strlen($description)) { $properties->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY); $properties->addTextContent(new PHUIRemarkupView($viewer, $description)); } return $properties; }