* create a new share * * @param $item_type * @param $item_source * @param $type * @param $user * @return bool * @throws Exception */
($item_type, $item_source, $type, $user)
| 81 | * @throws Exception |
| 82 | */ |
| 83 | public function create($item_type, $item_source, $type, $user) { |
| 84 | $token = null; |
| 85 | if ((int)$type === self::SHARE_TYPE_LINK) { |
| 86 | $token = $this->generateToken(); |
| 87 | } |
| 88 | $this->ShareMapper->createShare($item_type, $item_source, $type, $user, $token); |
| 89 | |
| 90 | switch ($item_type) { |
| 91 | case ShareService::SHARE_ITEM_TYPE_REPORT: |
| 92 | $this->ActivityManager->triggerEvent($item_source, ActivityManager::OBJECT_REPORT, ActivityManager::SUBJECT_REPORT_SHARE); |
| 93 | break; |
| 94 | case ShareService::SHARE_ITEM_TYPE_DATASET: |
| 95 | $this->ActivityManager->triggerEvent($item_source, ActivityManager::OBJECT_DATASET, ActivityManager::SUBJECT_DATASET_SHARE); |
| 96 | break; |
| 97 | case ShareService::SHARE_ITEM_TYPE_PANORAMA: |
| 98 | $this->ActivityManager->triggerEvent($item_source, ActivityManager::OBJECT_PANORAMA, ActivityManager::SUBJECT_PANORAMA_SHARE); |
| 99 | break; |
| 100 | } |
| 101 | return true; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * get all shares for a report or panorama |
no test coverage detected