Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100380764
DiffusionRepositoryPoliciesManagementPanel.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
Thu, Jan 30, 09:10
Size
2 KB
Mime Type
text/x-php
Expires
Sat, Feb 1, 09:10 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23927910
Attached To
rPH Phabricator
DiffusionRepositoryPoliciesManagementPanel.php
View Options
<?php
final
class
DiffusionRepositoryPoliciesManagementPanel
extends
DiffusionRepositoryManagementPanel
{
const
PANELKEY
=
'policies'
;
public
function
getManagementPanelLabel
()
{
return
pht
(
'Policies'
);
}
public
function
getManagementPanelOrder
()
{
return
300
;
}
// c4science customization
public
function
allowAccess
()
{
return
true
;
}
public
function
getManagementPanelIcon
()
{
return
'fa-lock'
;
}
protected
function
getEditEngineFieldKeys
()
{
return
array
(
'policy.view'
,
'policy.edit'
,
'spacePHID'
,
'policy.push'
,
);
}
public
function
buildManagementPanelCurtain
()
{
$repository
=
$this
->
getRepository
();
$viewer
=
$this
->
getViewer
();
$action_list
=
$this
->
newActionList
();
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$repository
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$edit_uri
=
$this
->
getEditPageURI
();
$action_list
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Edit Policies'
))
->
setHref
(
$edit_uri
)
->
setIcon
(
'fa-pencil'
)
->
setDisabled
(!
$can_edit
)
->
setWorkflow
(!
$can_edit
));
return
$this
->
newCurtainView
()
->
setActionList
(
$action_list
);
}
public
function
buildManagementPanelContent
()
{
$repository
=
$this
->
getRepository
();
$viewer
=
$this
->
getViewer
();
$view
=
id
(
new
PHUIPropertyListView
())
->
setViewer
(
$viewer
);
$descriptions
=
PhabricatorPolicyQuery
::
renderPolicyDescriptions
(
$viewer
,
$repository
);
$view_parts
=
array
();
if
(
PhabricatorSpacesNamespaceQuery
::
getViewerSpacesExist
(
$viewer
))
{
$space_phid
=
PhabricatorSpacesNamespaceQuery
::
getObjectSpacePHID
(
$repository
);
$view_parts
[]
=
$viewer
->
renderHandle
(
$space_phid
);
}
$view_parts
[]
=
$descriptions
[
PhabricatorPolicyCapability
::
CAN_VIEW
];
$view
->
addProperty
(
pht
(
'Visible To'
),
phutil_implode_html
(
"
\x
C2
\x
B7 "
,
$view_parts
));
$view
->
addProperty
(
pht
(
'Editable By'
),
$descriptions
[
PhabricatorPolicyCapability
::
CAN_EDIT
]);
$pushable
=
$repository
->
isHosted
()
?
$descriptions
[
DiffusionPushCapability
::
CAPABILITY
]
:
phutil_tag
(
'em'
,
array
(),
pht
(
'Not a Hosted Repository'
));
$view
->
addProperty
(
pht
(
'Pushable By'
),
$pushable
);
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$repository
,
PhabricatorPolicyCapability
::
CAN_EDIT
);
$edit_uri
=
$this
->
getEditPageURI
();
$button
=
id
(
new
PHUIButtonView
())
->
setTag
(
'a'
)
->
setIcon
(
'fa-pencil'
)
->
setText
(
pht
(
'Edit'
))
->
setHref
(
$edit_uri
)
->
setDisabled
(!
$can_edit
)
->
setWorkflow
(!
$can_edit
);
return
$this
->
newBox
(
pht
(
'Policies'
),
$view
,
array
(
$button
));
}
}
Event Timeline
Log In to Comment