本文整理匯總了PHP中OC_Util::isSharingDisabledForUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Util::isSharingDisabledForUser方法的具體用法?PHP OC_Util::isSharingDisabledForUser怎麽用?PHP OC_Util::isSharingDisabledForUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OC_Util
的用法示例。
在下文中一共展示了OC_Util::isSharingDisabledForUser方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isSharingDisabledForUser
/**
* check if sharing is disabled for the current user
*
* @return boolean
* @since 7.0.0
*/
public static function isSharingDisabledForUser()
{
return \OC_Util::isSharingDisabledForUser();
}
示例2: isSharingDisabledForUser
/**
* check if sharing is disabled for the current user
*
* @return boolean
* @since 7.0.0
*/
public static function isSharingDisabledForUser()
{
return \OC_Util::isSharingDisabledForUser(\OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getUserSession()->getUser());
}
示例3: getItems
//.........這裏部分代碼省略.........
} else {
$parentRow = $parentResult->fetchRow();
$tmpPath = $parentRow['file_target'];
// find the right position where the row path continues from the target path
$pos = strrpos($row['path'], $parentRow['file_target']);
$subPath = substr($row['path'], $pos);
$splitPath = explode('/', $subPath);
foreach (array_slice($splitPath, 2) as $pathPart) {
$tmpPath = $tmpPath . '/' . $pathPart;
}
$row['path'] = $tmpPath;
}
} else {
if (!isset($mounts[$row['storage']])) {
$mountPoints = \OC\Files\Filesystem::getMountByNumericId($row['storage']);
if (is_array($mountPoints) && !empty($mountPoints)) {
$mounts[$row['storage']] = current($mountPoints);
}
}
if (!empty($mounts[$row['storage']])) {
$path = $mounts[$row['storage']]->getMountPoint() . $row['path'];
$relPath = substr($path, $root);
// path relative to data/user
$row['path'] = rtrim($relPath, '/');
}
}
}
if ($checkExpireDate) {
if (self::expireItem($row)) {
continue;
}
}
// Check if resharing is allowed, if not remove share permission
if (isset($row['permissions']) && !self::isResharingAllowed() | \OC_Util::isSharingDisabledForUser()) {
$row['permissions'] &= ~\OCP\PERMISSION_SHARE;
}
// Add display names to result
if (isset($row['share_with']) && $row['share_with'] != '' && isset($row['share_with']) && $row['share_type'] === self::SHARE_TYPE_USER) {
$row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']);
} else {
$row['share_with_displayname'] = $row['share_with'];
}
if (isset($row['uid_owner']) && $row['uid_owner'] != '') {
$row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);
}
if ($row['permissions'] > 0) {
$items[$row['id']] = $row;
}
}
// group items if we are looking for items shared with the current user
if (isset($shareWith) && $shareWith === \OCP\User::getUser()) {
$items = self::groupItems($items, $itemType);
}
if (!empty($items)) {
$collectionItems = array();
foreach ($items as &$row) {
// Return only the item instead of a 2-dimensional array
if ($limit == 1 && $row[$column] == $item && ($row['item_type'] == $itemType || $itemType == 'file')) {
if ($format == self::FORMAT_NONE) {
return $row;
} else {
break;
}
}
// Check if this is a collection of the requested item type
if ($includeCollections && $collectionTypes && $row['item_type'] !== 'folder' && in_array($row['item_type'], $collectionTypes)) {
示例4: getPermissions
/**
* Get the permissions granted for a shared file
* @param string $target Shared target file path
* @return int CRUDS permissions granted
*/
public function getPermissions($target = '')
{
$permissions = $this->share['permissions'];
// part files and the mount point always have delete permissions
if ($target === '' || pathinfo($target, PATHINFO_EXTENSION) === 'part') {
$permissions |= \OCP\PERMISSION_DELETE;
}
if (\OC_Util::isSharingDisabledForUser()) {
$permissions &= ~\OCP\PERMISSION_SHARE;
}
return $permissions;
}
示例5: isSharable
public function isSharable($path)
{
if (\OC_Util::isSharingDisabledForUser()) {
return false;
}
return $this->isReadable($path);
}
示例6: testIsSharingDisabledForUser
/**
* @dataProvider dataProviderForTestIsSharingDisabledForUser
* @param array $groups existing groups
* @param array $membership groups the user belong to
* @param array $excludedGroups groups which should be excluded from sharing
* @param bool $expected expected result
*/
function testIsSharingDisabledForUser($groups, $membership, $excludedGroups, $expected)
{
$config = $this->getMockBuilder('OCP\\IConfig')->disableOriginalConstructor()->getMock();
$groupManager = $this->getMockBuilder('OCP\\IGroupManager')->disableOriginalConstructor()->getMock();
$user = $this->getMockBuilder('OCP\\IUser')->disableOriginalConstructor()->getMock();
$config->expects($this->at(0))->method('getAppValue')->with('core', 'shareapi_exclude_groups', 'no')->will($this->returnValue('yes'));
$config->expects($this->at(1))->method('getAppValue')->with('core', 'shareapi_exclude_groups_list')->will($this->returnValue(json_encode($excludedGroups)));
$groupManager->expects($this->at(0))->method('getUserGroupIds')->with($user)->will($this->returnValue($membership));
$result = \OC_Util::isSharingDisabledForUser($config, $groupManager, $user);
$this->assertSame($expected, $result);
}