@@ -272,7 +272,9 @@ |
||
272 | 272 | protected function unpad($data) { |
273 | 273 | $length = $this->getKeySize(); |
274 | 274 | $last = ord($data[strlen($data) - 1]); |
275 | - if ($last > $length) return false; |
|
275 | + if ($last > $length) { |
|
276 | + return false; |
|
277 | + } |
|
276 | 278 | if (substr($data, -1 * $last) !== str_repeat(chr($last), $last)) { |
277 | 279 | return false; |
278 | 280 | } |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | * @param null $user_id |
62 | 62 | * @return CredentialRevision[] |
63 | 63 | */ |
64 | - public function getRevisions($credential_id, $user_id = null){ |
|
64 | + public function getRevisions($credential_id, $user_id = null) { |
|
65 | 65 | $result = $this->credentialRevisionMapper->getRevisions($credential_id, $user_id); |
66 | - foreach ($result as $index => $revision){ |
|
66 | + foreach ($result as $index => $revision) { |
|
67 | 67 | $c = json_decode(base64_decode($revision->getCredentialData()), true); |
68 | 68 | $result[$index] = $revision->jsonSerialize(); |
69 | 69 | $result[$index]['credential_data'] = $this->encryptService->decryptCredential($c); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param null $user_id |
78 | 78 | * @return CredentialRevision |
79 | 79 | */ |
80 | - public function getRevision($credential_id, $user_id = null){ |
|
80 | + public function getRevision($credential_id, $user_id = null) { |
|
81 | 81 | $revision = $this->credentialRevisionMapper->getRevision($credential_id, $user_id); |
82 | 82 | $c = json_decode(base64_decode($revision->getCredentialData()), true); |
83 | 83 | $revision->setCredentialData($this->encryptService->decryptCredential($c)); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param $user_id |
91 | 91 | * @return CredentialRevision |
92 | 92 | */ |
93 | - public function deleteRevision($revision_id, $user_id){ |
|
93 | + public function deleteRevision($revision_id, $user_id) { |
|
94 | 94 | return $this->credentialRevisionMapper->deleteRevision($revision_id, $user_id); |
95 | 95 | } |
96 | 96 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param CredentialRevision $credentialRevision |
100 | 100 | * @return CredentialRevision |
101 | 101 | */ |
102 | - public function updateRevision(CredentialRevision $credentialRevision){ |
|
102 | + public function updateRevision(CredentialRevision $credentialRevision) { |
|
103 | 103 | $credential_data = $credentialRevision->getCredentialData(); |
104 | 104 | $credential_data = json_decode(base64_decode($credential_data), true); |
105 | 105 | $credential_data = base64_encode(json_encode($this->encryptService->encryptCredential($credential_data))); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param Credential $credential |
84 | 84 | * @return \OCP\AppFramework\Db\Entity |
85 | 85 | */ |
86 | - public function deleteCredential(Credential $credential){ |
|
86 | + public function deleteCredential(Credential $credential) { |
|
87 | 87 | return $this->credentialMapper->deleteCredential($credential); |
88 | 88 | } |
89 | 89 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getCredentialsByVaultId($vault_id, $user_id) { |
97 | 97 | $credentials = $this->credentialMapper->getCredentialsByVaultId($vault_id, $user_id); |
98 | - foreach ($credentials as $index => $credential){ |
|
98 | + foreach ($credentials as $index => $credential) { |
|
99 | 99 | $credentials[$index] = $this->encryptService->decryptCredential($credential); |
100 | 100 | } |
101 | 101 | return $credentials; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function getRandomCredentialByVaultId($vault_id, $user_id) { |
111 | 111 | $credentials = $this->credentialMapper->getRandomCredentialByVaultId($vault_id, $user_id); |
112 | - foreach ($credentials as $index => $credential){ |
|
112 | + foreach ($credentials as $index => $credential) { |
|
113 | 113 | $credentials[$index] = $this->encryptService->decryptCredential($credential); |
114 | 114 | } |
115 | 115 | return array_pop($credentials); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getExpiredCredentials($timestamp) { |
124 | 124 | $credentials = $this->credentialMapper->getExpiredCredentials($timestamp); |
125 | - foreach ($credentials as $index => $credential){ |
|
125 | + foreach ($credentials as $index => $credential) { |
|
126 | 126 | $credentials[$index] = $this->encryptService->decryptCredential($credential); |
127 | 127 | } |
128 | 128 | return $credentials; |
@@ -135,12 +135,11 @@ discard block |
||
135 | 135 | * @return Credential |
136 | 136 | * @throws DoesNotExistException |
137 | 137 | */ |
138 | - public function getCredentialById($credential_id, $user_id){ |
|
138 | + public function getCredentialById($credential_id, $user_id) { |
|
139 | 139 | $credential = $this->credentialMapper->getCredentialById($credential_id); |
140 | - if ($credential->getUserId() === $user_id){ |
|
140 | + if ($credential->getUserId() === $user_id) { |
|
141 | 141 | return $credential; |
142 | - } |
|
143 | - else { |
|
142 | + } else { |
|
144 | 143 | $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid()); |
145 | 144 | if ($acl->hasPermission(SharingACL::READ)) { |
146 | 145 | return $this->encryptService->decryptCredential($credential); |
@@ -155,7 +154,7 @@ discard block |
||
155 | 154 | * @param $credential_id |
156 | 155 | * @return Credential |
157 | 156 | */ |
158 | - public function getCredentialLabelById($credential_id){ |
|
157 | + public function getCredentialLabelById($credential_id) { |
|
159 | 158 | $credential = $this->credentialMapper->getCredentialLabelById($credential_id); |
160 | 159 | return $this->encryptService->decryptCredential($credential); |
161 | 160 | } |
@@ -166,7 +165,7 @@ discard block |
||
166 | 165 | * @param null $user_id |
167 | 166 | * @return Credential |
168 | 167 | */ |
169 | - public function getCredentialByGUID($credential_guid, $user_id = null){ |
|
168 | + public function getCredentialByGUID($credential_guid, $user_id = null) { |
|
170 | 169 | $credential = $this->credentialMapper->getCredentialByGUID($credential_guid); |
171 | 170 | return $this->encryptService->decryptCredential($credential); |
172 | 171 | } |