MCPcopy Create free account
hub / github.com/Rello/analytics / getShares

Method getShares

lib/ShareReview/ShareReviewSource.php:62–93  ·  view source on GitHub ↗

* Return all shares in the defined format * * [ * 'id' => (int) The unique identifier for the share,, * 'app' => (string) The name of the application, * 'object' => (string) The name/title of the object like file path or report name, * 'initiator' => (string) The userId of the initiator, * 'type' => (int) The OCP\Share\IShare type of the share, * 'recipient' => (string) The u

()

Source from the content-addressed store, hash-verified

60 * @throws Exception
61 */
62 public function getShares(): array {
63 $shares = $this->getAllShares();
64 $formatted = [];
65 foreach ($shares as $share) {
66 switch ($share['item_type']) {
67 case ShareService::SHARE_ITEM_TYPE_REPORT:
68 $object = $this->getSourceName(self::TABLE_NAME_REPORT, $share['item_source']) . ' (Report)';
69 break;
70 case ShareService::SHARE_ITEM_TYPE_DATASET:
71 $object = 'Dataset';
72 break;
73 case ShareService::SHARE_ITEM_TYPE_PANORAMA:
74 $object = $this->getSourceName(self::TABLE_NAME_PANORAMA, $share['item_source']) . ' (Panorama)';
75 break;
76 }
77
78 $data = [
79 'id' => $share['id'],
80 'app' => $this->getName(),
81 'object' => $object,
82 'initiator' => $share['uid_initiator'],
83 'type' => $share['type'],
84 'recipient' => $share['uid_owner'] != '' ? $share['uid_owner'] : $share['token'],
85 'permissions' => $share['permissions'] != '' ? $share['permissions'] : 1,
86 'time' => $share['created_at'] != null ? $share['created_at'] : '1970-01-01 01:00:00',
87 'action' => '',
88 ];
89
90 $formatted[] = $data;
91 }
92 return $formatted;
93 }
94
95 /**
96 * Delete a share by its id

Callers 1

readMethod · 0.45

Calls 3

getAllSharesMethod · 0.95
getSourceNameMethod · 0.95
getNameMethod · 0.95

Tested by

no test coverage detected