Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94014522
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
Tue, Dec 3, 06:32
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Dec 5, 06:32 (2 d)
Engine
blob
Format
Raw Data
Handle
22711132
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