Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106762675
PhabricatorPolicyTestObject.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 31, 06:22
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Apr 2, 06:22 (2 d)
Engine
blob
Format
Raw Data
Handle
25268959
Attached To
rPH Phabricator
PhabricatorPolicyTestObject.php
View Options
<?php
/**
* Configurable test object for implementing Policy unit tests.
*/
final
class
PhabricatorPolicyTestObject
extends
Phobject
implements
PhabricatorPolicyInterface
,
PhabricatorExtendedPolicyInterface
{
private
$phid
;
private
$capabilities
=
array
();
private
$policies
=
array
();
private
$automaticCapabilities
=
array
();
private
$extendedPolicies
=
array
();
public
function
setPHID
(
$phid
)
{
$this
->
phid
=
$phid
;
return
$this
;
}
public
function
getPHID
()
{
return
$this
->
phid
;
}
public
function
getCapabilities
()
{
return
$this
->
capabilities
;
}
public
function
getPolicy
(
$capability
)
{
return
idx
(
$this
->
policies
,
$capability
);
}
public
function
hasAutomaticCapability
(
$capability
,
PhabricatorUser
$viewer
)
{
$auto
=
idx
(
$this
->
automaticCapabilities
,
$capability
,
array
());
return
idx
(
$auto
,
$viewer
->
getPHID
());
}
public
function
setCapabilities
(
array
$capabilities
)
{
$this
->
capabilities
=
$capabilities
;
return
$this
;
}
public
function
setPolicies
(
array
$policy_map
)
{
$this
->
policies
=
$policy_map
;
return
$this
;
}
public
function
setAutomaticCapabilities
(
array
$auto_map
)
{
$this
->
automaticCapabilities
=
$auto_map
;
return
$this
;
}
public
function
setExtendedPolicies
(
array
$extended_policies
)
{
$this
->
extendedPolicies
=
$extended_policies
;
return
$this
;
}
public
function
getExtendedPolicy
(
$capability
,
PhabricatorUser
$viewer
)
{
return
idx
(
$this
->
extendedPolicies
,
$capability
,
array
());
}
}
Event Timeline
Log In to Comment