|
@@ 229-239 (lines=11) @@
|
| 226 |
|
* Manage sharing events |
| 227 |
|
* @param array $params The hook params |
| 228 |
|
*/ |
| 229 |
|
public function share($params) { |
| 230 |
|
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
| 231 |
|
if ((int) $params['shareType'] === Share::SHARE_TYPE_USER) { |
| 232 |
|
$this->shareFileOrFolderWithUser($params['shareWith'], (int) $params['fileSource'], $params['itemType'], $params['fileTarget'], true); |
| 233 |
|
} else if ((int) $params['shareType'] === Share::SHARE_TYPE_GROUP) { |
| 234 |
|
$this->shareFileOrFolderWithGroup($params['shareWith'], (int) $params['fileSource'], $params['itemType'], $params['fileTarget'], (int) $params['id'], true); |
| 235 |
|
} else if ((int) $params['shareType'] === Share::SHARE_TYPE_LINK) { |
| 236 |
|
$this->shareFileOrFolderByLink((int) $params['fileSource'], $params['itemType'], $params['uidOwner'], true); |
| 237 |
|
} |
| 238 |
|
} |
| 239 |
|
} |
| 240 |
|
|
| 241 |
|
/** |
| 242 |
|
* Manage sharing events |
|
@@ 245-255 (lines=11) @@
|
| 242 |
|
* Manage sharing events |
| 243 |
|
* @param array $params The hook params |
| 244 |
|
*/ |
| 245 |
|
public function unShare($params) { |
| 246 |
|
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
| 247 |
|
if ((int) $params['shareType'] === Share::SHARE_TYPE_USER) { |
| 248 |
|
$this->shareFileOrFolderWithUser($params['shareWith'], (int) $params['fileSource'], $params['itemType'], $params['fileTarget'], false); |
| 249 |
|
} else if ((int) $params['shareType'] === Share::SHARE_TYPE_GROUP) { |
| 250 |
|
$this->shareFileOrFolderWithGroup($params['shareWith'], (int) $params['fileSource'], $params['itemType'], $params['fileTarget'], (int) $params['id'], false); |
| 251 |
|
} else if ((int) $params['shareType'] === Share::SHARE_TYPE_LINK) { |
| 252 |
|
$this->shareFileOrFolderByLink((int) $params['fileSource'], $params['itemType'], $params['uidOwner'], false); |
| 253 |
|
} |
| 254 |
|
} |
| 255 |
|
} |
| 256 |
|
|
| 257 |
|
/** |
| 258 |
|
* Sharing a file or folder with a user |