Generate random token for private links (more entropy than past private links)
This commit is contained in:
parent
e896c0a9e3
commit
ccb5e99395
|
@ -253,11 +253,12 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$('#privateLinkCheckbox').live('change', function() {
|
||||
var itemType = $('#dropdown').data('item-type');
|
||||
var item = $('#dropdown').data('item');
|
||||
if (this.checked) {
|
||||
// Create a private link
|
||||
OC.Share.share(item, 'public', 0, function(token) {
|
||||
OC.Share.showPrivateLink(item, token);
|
||||
OC.Share.share(itemType, item, OC.Share.SHARE_TYPE_PRIVATE_LINK, 0, 0, function(token) {
|
||||
OC.Share.showPrivateLink(item, 'foo');
|
||||
// Change icon
|
||||
OC.Share.icons[item] = OC.imagePath('core', 'actions/public');
|
||||
});
|
||||
|
|
|
@ -179,11 +179,9 @@ class Share {
|
|||
$shareWith['group'] = $group;
|
||||
$shareWith['users'] = array_diff(\OC_Group::usersInGroup($group), array($uidOwner));
|
||||
break;
|
||||
case self::SHARETYPE_PRIVATE_LINK:
|
||||
// TODO don't loop through folder conversion
|
||||
$uidSharedWith = '';
|
||||
$gidSharedWith = null;
|
||||
break;
|
||||
case self::SHARE_TYPE_PRIVATE_LINK:
|
||||
$shareWith = md5(uniqid($item, true));
|
||||
return self::put($itemType, $item, $shareType, $shareWith, $uidOwner, $permissions);
|
||||
// Future share types need to include their own conditions
|
||||
default:
|
||||
\OC_Log::write('OCP\Share', 'Share type '.$shareType.' is not valid for '.$item, \OC_Log::ERROR);
|
||||
|
@ -629,8 +627,12 @@ class Share {
|
|||
// Return parent folders to preserve file target paths for potential children
|
||||
return $parentFolders;
|
||||
}
|
||||
} else {
|
||||
if ($shareType == self::SHARE_TYPE_PRIVATE_LINK) {
|
||||
$itemTarget = null;
|
||||
} else {
|
||||
$itemTarget = $backend->generateTarget($item, $shareWith);
|
||||
}
|
||||
if (isset($fileSource)) {
|
||||
if ($parentFolder) {
|
||||
if ($parentFolder === true) {
|
||||
|
@ -640,9 +642,13 @@ class Share {
|
|||
$fileTarget = $parentFolder['folder'].$item;
|
||||
$parent = $parentFolder['id'];
|
||||
}
|
||||
} else {
|
||||
if ($shareType == self::SHARE_TYPE_PRIVATE_LINK) {
|
||||
$fileTarget = basename($source['file']);
|
||||
} else {
|
||||
$fileTarget = self::getBackend('file')->generateTarget($source['file'], $shareWith);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$fileTarget = null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue