Skip to content

Commit

Permalink
imp: Deprecate the creation of sub-organizations
Browse files Browse the repository at this point in the history
More information: #516
  • Loading branch information
marien-probesys committed Dec 7, 2023
1 parent d263301 commit ee2cc44
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
17 changes: 2 additions & 15 deletions src/Command/SeedsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'name' => 'Probesys',
]);

// Make sure to have an ID for the Probesys organization.
$this->entityManager->flush();

$orgaWebDivision = $this->orgaRepository->findOneOrCreateBy([
'name' => 'Web team',
'parentsPath' => "/{$orgaProbesys->getId()}/",
]);

$orgaNetworkDivision = $this->orgaRepository->findOneOrCreateBy([
'name' => 'Network team',
'parentsPath' => "/{$orgaProbesys->getId()}/",
]);

$orgaFriendlyCoorp = $this->orgaRepository->findOneOrCreateBy([
'name' => 'Friendly Coorp',
]);
Expand Down Expand Up @@ -183,7 +170,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->authorizationRepository->grant($userAlix, $roleTech, null);
}

if (!$this->authorizationRepository->getOrgaAuthorizationFor($userBenedict, $orgaWebDivision)) {
if (!$this->authorizationRepository->getOrgaAuthorizationFor($userBenedict, null)) {
$this->authorizationRepository->grant($userBenedict, $roleSalesman, null);
}

Expand Down Expand Up @@ -299,7 +286,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'urgency' => 'medium',
'impact' => 'medium',
'priority' => 'medium',
'organization' => $orgaWebDivision,
'organization' => $orgaProbesys,
'requester' => $userBenedict,
'assignee' => null,
]);
Expand Down
4 changes: 4 additions & 0 deletions templates/organizations/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@
) }}
</ul>

{# Disabled while we are considering a better solution.
# See https://github.com/Probesys/bileto/issues/516
<div class="text--small">
<a href="{{ path('new organization', { parent: organization.uid }) }}">
{{ icon('plus') }}
{{ 'organizations.index.new_sub_organization' | trans }}
</a>
</div>
#}
</li>
{% endfor %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/SeedsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testExecute(): void

$this->assertSame(Command::SUCCESS, $tester->getStatusCode(), $tester->getDisplay());
$this->assertSame(4, RoleFactory::count());
$this->assertSame(4, OrganizationFactory::count());
$this->assertSame(2, OrganizationFactory::count());
$this->assertSame(3, UserFactory::count());
$this->assertSame(1, MailboxFactory::count());
}
Expand Down

0 comments on commit ee2cc44

Please sign in to comment.