本文整理匯總了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);
});
}