@@ -31,11 +31,11 @@ |
||
| 31 | 31 | const ICON_CACHE_OFFSET = 2592000; // 3600 * 24 * 30 |
| 32 | 32 | |
| 33 | 33 | public function __construct($AppName, |
| 34 | - IRequest $request, |
|
| 35 | - $UserId, |
|
| 36 | - CredentialService $credentialService, |
|
| 37 | - AppManager $am, |
|
| 38 | - IURLGenerator $urlGenerator |
|
| 34 | + IRequest $request, |
|
| 35 | + $UserId, |
|
| 36 | + CredentialService $credentialService, |
|
| 37 | + AppManager $am, |
|
| 38 | + IURLGenerator $urlGenerator |
|
| 39 | 39 | ) { |
| 40 | 40 | parent::__construct( |
| 41 | 41 | $AppName, |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | private $credentialService; |
| 29 | 29 | private $am; |
| 30 | 30 | private $urlGenerator; |
| 31 | - const ICON_CACHE_OFFSET = 2592000; // 3600 * 24 * 30 |
|
| 31 | + const ICON_CACHE_OFFSET = 2592000; // 3600 * 24 * 30 |
|
| 32 | 32 | |
| 33 | 33 | public function __construct($AppName, |
| 34 | 34 | IRequest $request, |
@@ -100,7 +100,9 @@ discard block |
||
| 100 | 100 | * @return Entity |
| 101 | 101 | */ |
| 102 | 102 | public function createACLEntry(SharingACL $acl) { |
| 103 | - if ($acl->getCreated() === null) $acl->setCreated((new \DateTime())->getTimestamp()); |
|
| 103 | + if ($acl->getCreated() === null) { |
|
| 104 | + $acl->setCreated((new \DateTime())->getTimestamp()); |
|
| 105 | + } |
|
| 104 | 106 | return $this->sharingACL->createACLEntry($acl); |
| 105 | 107 | } |
| 106 | 108 | |
@@ -158,13 +160,17 @@ discard block |
||
| 158 | 160 | $return = []; |
| 159 | 161 | foreach ($entries as $entry) { |
| 160 | 162 | // Check if the user can read the credential, probably unnecesary, but just to be sure |
| 161 | - if (!$entry->hasPermission(SharingACL::READ)) continue; |
|
| 163 | + if (!$entry->hasPermission(SharingACL::READ)) { |
|
| 164 | + continue; |
|
| 165 | + } |
|
| 162 | 166 | $tmp = $entry->jsonSerialize(); |
| 163 | 167 | $credential = $this->credential->getCredentialById($entry->getItemId()); |
| 164 | 168 | $credential = $this->encryptService->decryptCredential($credential); |
| 165 | 169 | $tmp['credential_data'] = $credential->jsonSerialize(); |
| 166 | 170 | |
| 167 | - if (!$entry->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']); |
|
| 171 | + if (!$entry->hasPermission(SharingACL::FILES)) { |
|
| 172 | + unset($tmp['credential_data']['files']); |
|
| 173 | + } |
|
| 168 | 174 | unset($tmp['credential_data']['shared_key']); |
| 169 | 175 | $return[] = $tmp; |
| 170 | 176 | } |
@@ -195,7 +201,9 @@ discard block |
||
| 195 | 201 | $acl = $this->sharingACL->getItemACL($user_id, $item_guid); |
| 196 | 202 | |
| 197 | 203 | // Check if the user can read the credential, probably unnecesary, but just to be sure |
| 198 | - if (!$acl->hasPermission(SharingACL::READ)) throw new DoesNotExistException("Item not found or wrong access level"); |
|
| 204 | + if (!$acl->hasPermission(SharingACL::READ)) { |
|
| 205 | + throw new DoesNotExistException("Item not found or wrong access level"); |
|
| 206 | + } |
|
| 199 | 207 | |
| 200 | 208 | $tmp = $acl->jsonSerialize(); |
| 201 | 209 | $credential = $this->credential->getCredentialById($acl->getItemId()); |
@@ -203,7 +211,9 @@ discard block |
||
| 203 | 211 | |
| 204 | 212 | $tmp['credential_data'] = $credential->jsonSerialize(); |
| 205 | 213 | |
| 206 | - if (!$acl->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']); |
|
| 214 | + if (!$acl->hasPermission(SharingACL::FILES)) { |
|
| 215 | + unset($tmp['credential_data']['files']); |
|
| 216 | + } |
|
| 207 | 217 | unset($tmp['credential_data']['shared_key']); |
| 208 | 218 | |
| 209 | 219 | return $tmp; |
@@ -221,7 +231,9 @@ discard block |
||
| 221 | 231 | */ |
| 222 | 232 | public function getItemHistory(?string $user_id, string $item_guid) { |
| 223 | 233 | $acl = $this->sharingACL->getItemACL($user_id, $item_guid); |
| 224 | - if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) return []; |
|
| 234 | + if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) { |
|
| 235 | + return []; |
|
| 236 | + } |
|
| 225 | 237 | |
| 226 | 238 | return $this->revisions->getRevisions($acl->getItemId()); |
| 227 | 239 | } |