1 | <?php |
||
18 | class ShareRequestMapper extends Mapper { |
||
19 | const TABLE_NAME = 'passman_share_request'; |
||
20 | |||
21 | public function __construct(IDBConnection $db) { |
||
22 | parent::__construct($db, self::TABLE_NAME); |
||
23 | } |
||
24 | |||
25 | public function createRequest(ShareRequest $request){ |
||
28 | |||
29 | /** |
||
30 | * Obtains a request by the given item and vault GUID pair |
||
31 | * @param $item_guid |
||
32 | * @param $target_vault_guid |
||
33 | * @return ShareRequest |
||
34 | */ |
||
35 | public function getRequestByItemAndVaultGuid($item_guid, $target_vault_guid){ |
||
39 | |||
40 | /** |
||
41 | * Get shared items for the given item_guid |
||
42 | * @param $item_guid |
||
43 | * @return ShareRequest[] |
||
44 | */ |
||
45 | public function getRequestsByItemGuidGroupedByUser($item_guid){ |
||
52 | |||
53 | /** |
||
54 | * Deletes all pending requests for the given user to the given item |
||
55 | * @param $item_id The item ID |
||
56 | * @param $target_user_id The target user |
||
57 | * @return \PDOStatement The result of running the db query |
||
58 | */ |
||
59 | public function cleanItemRequestsForUser($item_id, $target_user_id){ |
||
64 | |||
65 | /** |
||
66 | * Obtains all pending share requests for the given user ID |
||
67 | * @param $user_id |
||
68 | * @return ShareRequest[] |
||
69 | */ |
||
70 | public function getUserPendingRequests($user_id){ |
||
74 | |||
75 | /** |
||
76 | * Deletes the given share request |
||
77 | * @param ShareRequest $shareRequest Request to delete |
||
78 | * @return ShareRequest The deleted request |
||
79 | */ |
||
80 | public function deleteShareRequest(ShareRequest $shareRequest){ |
||
83 | |||
84 | /** |
||
85 | * Gets a share request by it's unique incremental id |
||
86 | * @param $id |
||
87 | * @return ShareRequest |
||
88 | * @throws DoesNotExistException |
||
89 | */ |
||
90 | public function getShareRequestById($id){ |
||
94 | |||
95 | /** |
||
96 | * Gets all share requests by a given item GUID |
||
97 | * @param $item_guid |
||
98 | * @return ShareRequest[] |
||
99 | */ |
||
100 | public function getShareRequestsByItemGuid($item_guid){ |
||
104 | |||
105 | /** |
||
106 | * Updates the given share request, |
||
107 | * @param ShareRequest $shareRequest |
||
108 | * @return ShareRequest |
||
109 | */ |
||
110 | public function updateShareRequest(ShareRequest $shareRequest){ |
||
113 | |||
114 | /** |
||
115 | * Finds pending requests sent to the given user to the given item. |
||
116 | * @param $item_guid |
||
117 | * @param $user_id |
||
118 | * @return ShareRequest[] |
||
119 | */ |
||
120 | public function getPendingShareRequests($item_guid, $user_id){ |
||
124 | |||
125 | /** |
||
126 | * Updates all pending requests with the given permissions |
||
127 | * @param $item_guid The item for which to update the requests |
||
128 | * @param $user_id The user for which to update the requests |
||
129 | * @param $permissions The new permissions to apply |
||
130 | * @return \PDOStatement The result of the operation |
||
131 | */ |
||
132 | public function updatePendingRequestPermissions($item_guid, $user_id, $permissions){ |
||
136 | |||
137 | } |