1 | <?php |
||
42 | class OcmMiddleware { |
||
43 | /** |
||
44 | * @var FederatedShareProvider |
||
45 | */ |
||
46 | protected $federatedShareProvider; |
||
47 | |||
48 | /** |
||
49 | * @var IAppManager |
||
50 | */ |
||
51 | protected $appManager; |
||
52 | |||
53 | /** |
||
54 | * @var IUserManager |
||
55 | */ |
||
56 | protected $userManager; |
||
57 | |||
58 | /** |
||
59 | * @var AddressHandler |
||
60 | */ |
||
61 | protected $addressHandler; |
||
62 | |||
63 | /** |
||
64 | * @var ILogger |
||
65 | */ |
||
66 | protected $logger; |
||
67 | |||
68 | /** |
||
69 | * constructor. |
||
70 | * |
||
71 | * @param FederatedShareProvider $federatedShareProvider |
||
72 | * @param IAppManager $appManager |
||
73 | * @param IUserManager $userManager |
||
74 | * @param AddressHandler $addressHandler |
||
75 | * @param ILogger $logger |
||
76 | */ |
||
77 | public function __construct( |
||
90 | |||
91 | /** |
||
92 | * Check if value an array has any null item |
||
93 | * |
||
94 | * @param string[] $params |
||
95 | * |
||
96 | * @return bool |
||
97 | * |
||
98 | * @throws BadRequestException |
||
99 | */ |
||
100 | public function assertNotNull($params) { |
||
118 | |||
119 | /** |
||
120 | * Get share by id, validate its type and token |
||
121 | * |
||
122 | * @param int $id |
||
123 | * @param string $sharedSecret |
||
124 | * |
||
125 | * @return IShare |
||
126 | * |
||
127 | * @throws BadRequestException |
||
128 | * @throws ForbiddenException |
||
129 | */ |
||
130 | public function getValidShare($id, $sharedSecret) { |
||
145 | |||
146 | /** |
||
147 | * @param IShare $share |
||
148 | * |
||
149 | * @return void |
||
150 | * |
||
151 | * @throws BadRequestException |
||
152 | */ |
||
153 | public function assertSharingPermissionSet(IShare $share) { |
||
159 | |||
160 | /** |
||
161 | * @param Address $user1 |
||
162 | * @param Address $user2 |
||
163 | * |
||
164 | * @return void |
||
165 | * |
||
166 | * @throws ForbiddenException |
||
167 | */ |
||
168 | public function assertNotSameUser(Address $user1, Address $user2) { |
||
173 | |||
174 | /** |
||
175 | * Make sure that incoming shares are enabled |
||
176 | * |
||
177 | * @return void |
||
178 | * |
||
179 | * @throws NotImplementedException |
||
180 | */ |
||
181 | public function assertIncomingSharingEnabled() { |
||
188 | |||
189 | /** |
||
190 | * Make sure that outgoing shares are enabled |
||
191 | * |
||
192 | * @return void |
||
193 | * |
||
194 | * @throws NotImplementedException |
||
195 | */ |
||
196 | public function assertOutgoingSharingEnabled() { |
||
203 | } |
||
204 |