本文整理汇总了Java中org.alfresco.service.cmr.security.PermissionService.hasPermission方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionService.hasPermission方法的具体用法?Java PermissionService.hasPermission怎么用?Java PermissionService.hasPermission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.security.PermissionService
的用法示例。
在下文中一共展示了PermissionService.hasPermission方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toDisplayPath
import org.alfresco.service.cmr.security.PermissionService; //导入方法依赖的package包/类
/**
* Return the human readable form of the specified node Path. Slow version of the method
* that extracts the name of each node in the Path from the supplied NodeService.
*
* @return human readable form of the Path excluding the final element
*/
public String toDisplayPath(NodeService nodeService, PermissionService permissionService)
{
StringBuilder buf = new StringBuilder(64);
for (int i=0; i<elements.size()-1; i++)
{
String elementString = null;
Element element = elements.get(i);
if (element instanceof ChildAssocElement)
{
ChildAssociationRef elementRef = ((ChildAssocElement)element).getRef();
if (elementRef.getParentRef() != null)
{
Serializable nameProp = null;
if (permissionService.hasPermission(
elementRef.getChildRef(), PermissionService.READ) == AccessStatus.ALLOWED)
{
nameProp = nodeService.getProperty(elementRef.getChildRef(), ContentModel.PROP_NAME);
// use the name property if we are allowed access to it
elementString = nameProp.toString();
}
else
{
// revert to using QName if not
elementString = elementRef.getQName().getLocalName();
}
}
}
else
{
elementString = element.getElementString();
}
if (elementString != null)
{
buf.append("/");
buf.append(elementString);
}
}
return buf.toString();
}