Commit 5113251d authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

fix() : remove calls to readDescendantServices to reduce processing times

parent 04777e00
......@@ -481,6 +481,12 @@ class digitalSafe
$archiveId = null,
$hasLog = true
) {
$currentUserService = \laabs::getToken("ORGANIZATION");
$org = $this->organizationController->getOrgByRegNumber($originatorOrgRegNumber);
$positionAncestors = $this->organizationController->readParentOrg($this->organizationController->getOrgByRegNumber($originatorOrgRegNumber)->orgId);
$positionAncestors[] = $org;
$queryParts = array();
$queryParams = array();
......@@ -500,20 +506,11 @@ class digitalSafe
throw $this->getThrowable("The organization must not be a organization unit", 403, $replyMessage);
}
$userPositions = $this->userPositionController->listPositions($this->account->accountId);
$userPositions[] = $this->servicePositionController->getPosition($this->account->accountId);
$userPosition = $this->servicePositionController->getPosition($this->account->accountId);
$organizations = $this->organizationController->readDescendantServices($organization->orgId);
$userOrganisations = [];
foreach ($organizations as $organization) {
if (is_null($originatorOrgRegNumber)
|| $originatorOrgRegNumber == $organization->registrationNumber) {
foreach ($userPositions as $userPosition) {
if ($userPosition->orgId == $organization->orgId) {
$userOrganisations[] = $organization;
}
}
foreach ($positionAncestors as $orgUnit) {
if ($orgUnit->registrationNumber == $currentUserService->registrationNumber) {
$userOrganisations[] = $org;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment