Skip to content

Commit

Permalink
Merge pull request #116 from ConductionNL/development
Browse files Browse the repository at this point in the history
Dev to main synchronization fix
  • Loading branch information
rjzondervan authored Dec 4, 2024
2 parents ec6f653 + a7d9268 commit c5f05ef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/Cron/ActionTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use OCP\BackgroundJob\TimedJob;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\IUserManager;
use OCP\IUserSession;
use Psr\Container\ContainerInterface;
use Symfony\Component\Uid\Uuid;
use DateInterval;
Expand All @@ -30,7 +32,9 @@ public function __construct(
JobMapper $jobMapper,
JobLogMapper $jobLogMapper,
IJobList $jobList,
ContainerInterface $containerInterface
ContainerInterface $containerInterface,
private IUserSession $userSession,
private IUserManager $userManager,
) {
parent::__construct($time);
$this->jobMapper = $jobMapper;
Expand Down Expand Up @@ -80,6 +84,11 @@ public function run($argument)
return;
}

if(empty($job->getUserId()) === false && $this->userSession->getUser() === null) {
$user = $this->userManager->get($job->getUserId());
$this->userSession->setUser($user);
}

$time_start = microtime(true);

$action = $this->containerInterface->get($job->getJobClass());
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/AuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function fetchDecosToken(array $configuration): string
private function getRSJWK(array $configuration): ?JWK
{
$stamp = microtime().getmypid();
$filename = "privatekey-$stamp";
$filename = "/var/tmp/privatekey-$stamp";
file_put_contents($filename, base64_decode($configuration['secret']));
$jwk = null;
try {
Expand Down
7 changes: 6 additions & 1 deletion lib/Service/SynchronizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ public function synchronizeContract(SynchronizationContract $synchronizationCont
}
}

// @TODO: This should be unset through pre-mapping
if(isset($object['d']['vti_x005f_dirlateststamp']) === true) {
unset($object['d']['vti_x005f_dirlateststamp']);
}


// Let create a source hash for the object
$originHash = md5(serialize($object));
Expand All @@ -329,7 +334,7 @@ public function synchronizeContract(SynchronizationContract $synchronizationCont
// The object has not changed and the config has not been updated since last check
return $synchronizationContract;
}

// The object has changed, oke let do mappig and bla die bla
$synchronizationContract->setOriginHash($originHash);
$synchronizationContract->setSourceLastChanged(new DateTime());
Expand Down

0 comments on commit c5f05ef

Please sign in to comment.