@@ -11,7 +11,6 @@ discard block |
||
11 | 11 | |
12 | 12 | namespace OCA\Passman\Controller; |
13 | 13 | |
14 | -use OCA\Files_External\NotFoundException; |
|
15 | 14 | use OCA\Passman\Db\SharingACL; |
16 | 15 | use OCA\Passman\Utility\NotFoundJSONResponse; |
17 | 16 | use OCP\AppFramework\Db\DoesNotExistException; |
@@ -25,7 +24,6 @@ discard block |
||
25 | 24 | use OCA\Passman\Service\ActivityService; |
26 | 25 | use OCA\Passman\Service\CredentialRevisionService; |
27 | 26 | use OCA\Passman\Service\ShareService; |
28 | -use OCP\IUser; |
|
29 | 27 | |
30 | 28 | class CredentialController extends ApiController { |
31 | 29 | private $userId; |
@@ -257,21 +257,18 @@ |
||
257 | 257 | public function getRevision($credential_guid) { |
258 | 258 | try { |
259 | 259 | $credential = $this->credentialService->getCredentialByGUID($credential_guid); |
260 | - } |
|
261 | - catch (DoesNotExistException $ex){ |
|
260 | + } catch (DoesNotExistException $ex){ |
|
262 | 261 | return new NotFoundJSONResponse(); |
263 | 262 | } |
264 | 263 | |
265 | 264 | // If the request was made by the owner of the credential |
266 | 265 | if ($this->userId == $credential->getUserId()) { |
267 | 266 | $result = $this->credentialRevisionService->getRevisions($credential->getId(), $this->userId); |
268 | - } |
|
269 | - else { |
|
267 | + } else { |
|
270 | 268 | $acl = $this->sharingService->getACL($this->userId, $credential_guid); |
271 | 269 | if ($acl->hasPermission(SharingACL::HISTORY)){ |
272 | 270 | $result = $this->credentialRevisionService->getRevisions($credential->getId()); |
273 | - } |
|
274 | - else { |
|
271 | + } else { |
|
275 | 272 | return new NotFoundJSONResponse(); |
276 | 273 | } |
277 | 274 | } |
@@ -11,10 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | namespace OCA\Passman\Controller; |
13 | 13 | |
14 | -use OCA\Files_External\NotFoundException; |
|
15 | -use OCA\Passman\Db\ShareRequest; |
|
16 | 14 | use OCA\Passman\Db\SharingACL; |
17 | -use OCA\Passman\Db\Vault; |
|
18 | 15 | use OCA\Passman\Service\CredentialService; |
19 | 16 | use OCA\Passman\Service\FileService; |
20 | 17 | use OCA\Passman\Service\NotificationService; |
@@ -26,14 +23,9 @@ discard block |
||
26 | 23 | use OCP\IRequest; |
27 | 24 | use OCP\AppFramework\Http\JSONResponse; |
28 | 25 | use OCP\AppFramework\ApiController; |
29 | -use OCP\AppFramework\Http; |
|
30 | -use OCP\AppFramework\Http\DataResponse; |
|
31 | - |
|
32 | -use OCP\IGroup; |
|
33 | 26 | use OCP\IGroupManager; |
34 | 27 | use OCP\IUserManager; |
35 | 28 | use OCP\IUser; |
36 | - |
|
37 | 29 | use OCA\Passman\Service\VaultService; |
38 | 30 | use OCA\Passman\Service\ActivityService; |
39 | 31 | use OCA\Passman\Activity; |
@@ -11,7 +11,6 @@ discard block |
||
11 | 11 | |
12 | 12 | namespace OCA\Passman\AppInfo; |
13 | 13 | use OC\Files\View; |
14 | - |
|
15 | 14 | use OCA\Passman\Controller\CredentialController; |
16 | 15 | use OCA\Passman\Controller\PageController; |
17 | 16 | use OCA\Passman\Controller\ShareController; |
@@ -24,10 +23,8 @@ discard block |
||
24 | 23 | use OCA\Passman\Service\VaultService; |
25 | 24 | use OCA\Passman\Utility\Utils; |
26 | 25 | use OCA\Passman\Service\NotificationService; |
27 | - |
|
28 | 26 | use OCP\AppFramework\App; |
29 | 27 | use OCP\IL10N; |
30 | -use OCP\Util; |
|
31 | 28 | class Application extends App { |
32 | 29 | public function __construct () { |
33 | 30 | parent::__construct('passman'); |
@@ -8,7 +8,6 @@ |
||
8 | 8 | namespace OCA\Passman\Db; |
9 | 9 | |
10 | 10 | use OCA\Passman\Utility\PermissionEntity; |
11 | -use OCP\AppFramework\Db\Entity; |
|
12 | 11 | |
13 | 12 | /** |
14 | 13 | * @method void setId(integer $value) |
@@ -14,9 +14,7 @@ |
||
14 | 14 | use OCA\Passman\Db\Credential; |
15 | 15 | use OCA\Passman\Db\SharingACL; |
16 | 16 | use OCA\Passman\Db\SharingACLMapper; |
17 | -use OCP\IConfig; |
|
18 | 17 | use OCP\AppFramework\Db\DoesNotExistException; |
19 | - |
|
20 | 18 | use OCA\Passman\Db\CredentialMapper; |
21 | 19 | |
22 | 20 |
@@ -61,8 +61,7 @@ |
||
61 | 61 | $filter = [$item_guid]; |
62 | 62 | if ($user_id == null){ |
63 | 63 | $q .= 'user_id is null'; |
64 | - } |
|
65 | - else { |
|
64 | + } else { |
|
66 | 65 | $q .= 'user_id = ? '; |
67 | 66 | $filter[] = $user_id; |
68 | 67 | } |
@@ -11,9 +11,6 @@ |
||
11 | 11 | |
12 | 12 | namespace OCA\Passman\Service; |
13 | 13 | |
14 | -use OCP\IConfig; |
|
15 | -use OCP\AppFramework\Db\DoesNotExistException; |
|
16 | - |
|
17 | 14 | use OCA\Passman\Db\FileMapper; |
18 | 15 | |
19 | 16 |
@@ -9,7 +9,6 @@ |
||
9 | 9 | namespace OCA\Passman\Service; |
10 | 10 | |
11 | 11 | |
12 | -use Icewind\SMB\Share; |
|
13 | 12 | use OCA\Passman\Db\CredentialMapper; |
14 | 13 | use OCA\Passman\Db\CredentialRevision; |
15 | 14 | use OCA\Passman\Db\ShareRequest; |
@@ -71,7 +71,9 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | public function createACLEntry(SharingACL $acl) { |
74 | - if ($acl->getCreated() == null) $acl->setCreated((new \DateTime())->getTimestamp()); |
|
74 | + if ($acl->getCreated() == null) { |
|
75 | + $acl->setCreated((new \DateTime())->getTimestamp()); |
|
76 | + } |
|
75 | 77 | return $this->sharingACL->createACLEntry($acl); |
76 | 78 | } |
77 | 79 | |
@@ -124,12 +126,16 @@ discard block |
||
124 | 126 | $return = []; |
125 | 127 | foreach ($entries as $entry) { |
126 | 128 | // Check if the user can read the credential, probably unnecesary, but just to be sure |
127 | - if (!$entry->hasPermission(SharingACL::READ)) continue; |
|
129 | + if (!$entry->hasPermission(SharingACL::READ)) { |
|
130 | + continue; |
|
131 | + } |
|
128 | 132 | |
129 | 133 | $tmp = $entry->jsonSerialize(); |
130 | 134 | $tmp['credential_data'] = $this->credential->getCredentialById($entry->getItemId())->jsonSerialize(); |
131 | 135 | |
132 | - if (!$entry->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']); |
|
136 | + if (!$entry->hasPermission(SharingACL::FILES)) { |
|
137 | + unset($tmp['credential_data']['files']); |
|
138 | + } |
|
133 | 139 | unset($tmp['credential_data']['shared_key']); |
134 | 140 | $return[] = $tmp; |
135 | 141 | } |
@@ -150,12 +156,16 @@ discard block |
||
150 | 156 | $acl = $this->sharingACL->getItemACL($user_id, $item_guid); |
151 | 157 | |
152 | 158 | // Check if the user can read the credential, probably unnecesary, but just to be sure |
153 | - if (!$acl->hasPermission(SharingACL::READ)) throw new DoesNotExistException("Item not found or wrong access level"); |
|
159 | + if (!$acl->hasPermission(SharingACL::READ)) { |
|
160 | + throw new DoesNotExistException("Item not found or wrong access level"); |
|
161 | + } |
|
154 | 162 | |
155 | 163 | $tmp = $acl->jsonSerialize(); |
156 | 164 | $tmp['credential_data'] = $this->credential->getCredentialById($acl->getItemId())->jsonSerialize(); |
157 | 165 | |
158 | - if (!$acl->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']); |
|
166 | + if (!$acl->hasPermission(SharingACL::FILES)) { |
|
167 | + unset($tmp['credential_data']['files']); |
|
168 | + } |
|
159 | 169 | unset($tmp['credential_data']['shared_key']); |
160 | 170 | |
161 | 171 | return $tmp; |
@@ -170,7 +180,9 @@ discard block |
||
170 | 180 | */ |
171 | 181 | public function getItemHistory($user_id, $item_guid) { |
172 | 182 | $acl = $this->sharingACL->getItemACL($user_id, $item_guid); |
173 | - if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) return []; |
|
183 | + if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) { |
|
184 | + return []; |
|
185 | + } |
|
174 | 186 | |
175 | 187 | return $this->revisions->getRevisions($acl->getItemId()); |
176 | 188 | } |
@@ -61,8 +61,7 @@ |
||
61 | 61 | $filter = [$item_guid]; |
62 | 62 | if ($user_id == null){ |
63 | 63 | $q .= 'user_id is null'; |
64 | - } |
|
65 | - else { |
|
64 | + } else { |
|
66 | 65 | $q .= 'user_id = ? '; |
67 | 66 | $filter[] = $user_id; |
68 | 67 | } |
@@ -8,7 +8,6 @@ |
||
8 | 8 | namespace OCA\Passman\Db; |
9 | 9 | |
10 | 10 | use OCA\Passman\Utility\PermissionEntity; |
11 | -use OCP\AppFramework\Db\Entity; |
|
12 | 11 | |
13 | 12 | /** |
14 | 13 | * @method void setId(integer $value) |