本文整理汇总了PHP中Sabre\DAV\INode::getSystemTag方法的典型用法代码示例。如果您正苦于以下问题:PHP INode::getSystemTag方法的具体用法?PHP INode::getSystemTag怎么用?PHP INode::getSystemTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\INode
的用法示例。
在下文中一共展示了INode::getSystemTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleGetProperties
/**
* Retrieves system tag properties
*
* @param PropFind $propFind
* @param \Sabre\DAV\INode $node
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
{
if (!$node instanceof SystemTagNode) {
return;
}
$propFind->handle(self::ID_PROPERTYNAME, function () use($node) {
return $node->getSystemTag()->getId();
});
$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use($node) {
return $node->getSystemTag()->getName();
});
$propFind->handle(self::USERVISIBLE_PROPERTYNAME, function () use($node) {
return (int) $node->getSystemTag()->isUserVisible();
});
$propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function () use($node) {
return (int) $node->getSystemTag()->isUserAssignable();
});
}
示例2: handleGetProperties
/**
* Retrieves system tag properties
*
* @param PropFind $propFind
* @param \Sabre\DAV\INode $node
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
{
if (!$node instanceof SystemTagNode && !$node instanceof SystemTagMappingNode) {
return;
}
$propFind->handle(self::ID_PROPERTYNAME, function () use($node) {
return $node->getSystemTag()->getId();
});
$propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use($node) {
return $node->getSystemTag()->getName();
});
$propFind->handle(self::USERVISIBLE_PROPERTYNAME, function () use($node) {
return $node->getSystemTag()->isUserVisible() ? 'true' : 'false';
});
$propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function () use($node) {
// this is the tag's inherent property "is user assignable"
return $node->getSystemTag()->isUserAssignable() ? 'true' : 'false';
});
$propFind->handle(self::CANASSIGN_PROPERTYNAME, function () use($node) {
// this is the effective permission for the current user
return $this->tagManager->canUserAssignTag($node->getSystemTag(), $this->userSession->getUser()) ? 'true' : 'false';
});
$propFind->handle(self::GROUPS_PROPERTYNAME, function () use($node) {
if (!$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) {
// property only available for admins
throw new Forbidden();
}
$groups = [];
// no need to retrieve groups for namespaces that don't qualify
if ($node->getSystemTag()->isUserVisible() && !$node->getSystemTag()->isUserAssignable()) {
$groups = $this->tagManager->getTagGroups($node->getSystemTag());
}
return implode('|', $groups);
});
}