Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/oauthserver/phid/PhabricatorOAuthServerClientPHIDType.php b/src/applications/oauthserver/phid/PhabricatorOAuthServerClientPHIDType.php
index a4d8834b96..4d3d64738b 100644
--- a/src/applications/oauthserver/phid/PhabricatorOAuthServerClientPHIDType.php
+++ b/src/applications/oauthserver/phid/PhabricatorOAuthServerClientPHIDType.php
@@ -1,39 +1,41 @@
<?php
final class PhabricatorOAuthServerClientPHIDType extends PhabricatorPHIDType {
const TYPECONST = 'OASC';
public function getTypeName() {
return pht('OAuth Application');
}
public function newObject() {
return new PhabricatorOAuthServerClient();
}
public function getPHIDTypeApplicationClass() {
return 'PhabricatorOAuthServerApplication';
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhabricatorOAuthServerClientQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$client = $objects[$phid];
- $handle->setName($client->getName());
+ $handle
+ ->setName($client->getName())
+ ->setURI($client->getURI());
}
}
}
diff --git a/src/applications/oauthserver/storage/PhabricatorOAuthServerClient.php b/src/applications/oauthserver/storage/PhabricatorOAuthServerClient.php
index a951bf5781..471433ad4b 100644
--- a/src/applications/oauthserver/storage/PhabricatorOAuthServerClient.php
+++ b/src/applications/oauthserver/storage/PhabricatorOAuthServerClient.php
@@ -1,129 +1,135 @@
<?php
final class PhabricatorOAuthServerClient
extends PhabricatorOAuthServerDAO
implements
PhabricatorPolicyInterface,
PhabricatorApplicationTransactionInterface,
PhabricatorDestructibleInterface {
protected $secret;
protected $name;
protected $redirectURI;
protected $creatorPHID;
protected $isTrusted;
protected $viewPolicy;
protected $editPolicy;
protected $isDisabled;
public function getEditURI() {
$id = $this->getID();
return "/oauthserver/edit/{$id}/";
}
public function getViewURI() {
$id = $this->getID();
return "/oauthserver/client/view/{$id}/";
}
public static function initializeNewClient(PhabricatorUser $actor) {
return id(new PhabricatorOAuthServerClient())
->setCreatorPHID($actor->getPHID())
->setSecret(Filesystem::readRandomCharacters(32))
->setViewPolicy(PhabricatorPolicies::POLICY_USER)
->setEditPolicy($actor->getPHID())
->setIsDisabled(0)
->setIsTrusted(0);
}
protected function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'secret' => 'text32',
'redirectURI' => 'text255',
'isTrusted' => 'bool',
'isDisabled' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
'creatorPHID' => array(
'columns' => array('creatorPHID'),
),
),
) + parent::getConfiguration();
}
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorOAuthServerClientPHIDType::TYPECONST);
}
+ public function getURI() {
+ return urisprintf(
+ '/oauthserver/client/view/%d/',
+ $this->getID());
+ }
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
public function getCapabilities() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
);
}
public function getPolicy($capability) {
switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW:
return $this->getViewPolicy();
case PhabricatorPolicyCapability::CAN_EDIT:
return $this->getEditPolicy();
}
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
return false;
}
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
public function getApplicationTransactionEditor() {
return new PhabricatorOAuthServerEditor();
}
public function getApplicationTransactionTemplate() {
return new PhabricatorOAuthServerTransaction();
}
/* -( PhabricatorDestructibleInterface )----------------------------------- */
public function destroyObjectPermanently(
PhabricatorDestructionEngine $engine) {
$this->openTransaction();
$this->delete();
$authorizations = id(new PhabricatorOAuthClientAuthorization())
->loadAllWhere('clientPHID = %s', $this->getPHID());
foreach ($authorizations as $authorization) {
$authorization->delete();
}
$tokens = id(new PhabricatorOAuthServerAccessToken())
->loadAllWhere('clientPHID = %s', $this->getPHID());
foreach ($tokens as $token) {
$token->delete();
}
$codes = id(new PhabricatorOAuthServerAuthorizationCode())
->loadAllWhere('clientPHID = %s', $this->getPHID());
foreach ($codes as $code) {
$code->delete();
}
$this->saveTransaction();
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jul 2, 2:26 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
164615
Default Alt Text
(5 KB)

Event Timeline