Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
stlye fix
Signed-off-by: Sagar <[email protected]>
  • Loading branch information
SagarGi committed Sep 5, 2024
commit bcc43be4de0f970ba273093c15d48ca973b27c66
8 changes: 4 additions & 4 deletions lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private function setIntegrationConfig(array $values): array {
throw new NoUserException('User "' . Application::OPEN_PROJECT_ENTITIES_NAME . '" does not exists to create application password');
}
$appPassword = $this->openprojectAPIService->generateAppPasswordTokenForUser();
if($isAppPasswordBeingReplaced) {
if ($isAppPasswordBeingReplaced) {
$this->openprojectAPIService->logToAuditFile(
"Application password for user 'OpenProject has been replaced' with new password in application " . Application::APP_ID
);
Expand Down Expand Up @@ -290,7 +290,7 @@ private function setIntegrationConfig(array $values): array {
// resetting and keeping the project folder setup should delete the user app password
if (key_exists('setup_app_password', $values) && $values['setup_app_password'] === false) {
$this->openprojectAPIService->deleteAppPassword();
if(!$runningFullReset) {
if (!$runningFullReset) {
$this->openprojectAPIService->logToAuditFile(
"Project folder setup has been deactivated in application " . Application::APP_ID
);
Expand Down Expand Up @@ -389,14 +389,14 @@ public function setAdminConfig(array $values): DataResponse {
$values['openproject_client_id'] &&
$values['openproject_client_secret'];

if(key_exists('openproject_instance_url', $values) &&
if (key_exists('openproject_instance_url', $values) &&
$values['openproject_instance_url'] && !$isOPOAuthCrdentialSet) {
// sending admin audit log if admin has changed or added the openproject host url
$this->openprojectAPIService->logToAuditFile(
"OpenProject host url has been set to '" . $values['openproject_instance_url'] . "' in application " . Application::APP_ID
);
}
if($isOPOAuthCrdentialSet) {
if ($isOPOAuthCrdentialSet) {
$this->openprojectAPIService->logToAuditFile(
"OpenProject OAuth credential 'openproject_client_id' and 'openproject_client_secret' has been set in application " . Application::APP_ID
);
Expand Down
6 changes: 5 additions & 1 deletion lib/Service/OauthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ public function createNcOauthClient(string $name, string $redirectUri): array {
$client->setName($name);
$client->setRedirectUri(sprintf($redirectUri, $clientId));
$secret = $this->secureRandom->generate(64, self::validChars);
$encryptedSecret = $this->crypto->encrypt($secret);
if (version_compare(OC_Util::getVersionString(), '27.0.1') >= 0) {
$encryptedSecret = $this->crypto->encrypt($secret);
} else {
$encryptedSecret = $secret;
}
$client->setSecret($encryptedSecret);
$client->setClientIdentifier($clientId);
$client = $this->clientMapper->insert($client);
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/OpenProjectAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ class_exists('\OCA\GroupFolders\Folder\FolderManager') &&
* @return void
*/
public function logToAuditFile($auditLogMessage): void {
if($this->isAdminAuditConfigSetCorrectly()) {
if ($this->isAdminAuditConfigSetCorrectly()) {
$this->auditLogger = new AuditLogger($this->logFactory, $this->config);
$this->auditLogger->info($auditLogMessage,
['app' => 'admin_audit']
Expand Down