Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104525454
PhabricatorOAuthServerClient.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Mar 10, 04:17
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Mar 12, 04:17 (1 d, 18 h)
Engine
blob
Format
Raw Data
Handle
24804710
Attached To
rPH Phabricator
PhabricatorOAuthServerClient.php
View Options
<?php
final
class
PhabricatorOAuthServerClient
extends
PhabricatorOAuthServerDAO
implements
PhabricatorPolicyInterface
{
protected
$secret
;
protected
$name
;
protected
$redirectURI
;
protected
$creatorPHID
;
public
function
getEditURI
()
{
return
'/oauthserver/client/edit/'
.
$this
->
getPHID
().
'/'
;
}
public
function
getViewURI
()
{
return
'/oauthserver/client/view/'
.
$this
->
getPHID
().
'/'
;
}
public
function
getDeleteURI
()
{
return
'/oauthserver/client/delete/'
.
$this
->
getPHID
().
'/'
;
}
public
static
function
initializeNewClient
(
PhabricatorUser
$actor
)
{
return
id
(
new
PhabricatorOAuthServerClient
())
->
setCreatorPHID
(
$actor
->
getPHID
())
->
setSecret
(
Filesystem
::
readRandomCharacters
(
32
));
}
public
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_AUX_PHID
=>
true
,
)
+
parent
::
getConfiguration
();
}
public
function
generatePHID
()
{
return
PhabricatorPHID
::
generateNewPHID
(
PhabricatorOAuthServerClientPHIDType
::
TYPECONST
);
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */
public
function
getCapabilities
()
{
return
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
);
}
public
function
getPolicy
(
$capability
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_VIEW
:
return
PhabricatorPolicies
::
POLICY_USER
;
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
PhabricatorPolicies
::
POLICY_NOONE
;
}
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$viewer
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
(
$viewer
->
getPHID
()
==
$this
->
getCreatorPHID
());
}
return
false
;
}
public
function
describeAutomaticCapability
(
$capability
)
{
switch
(
$capability
)
{
case
PhabricatorPolicyCapability
::
CAN_EDIT
:
return
pht
(
"Only an application's creator can edit it."
);
}
return
null
;
}
}
Event Timeline
Log In to Comment