Skip to content

Commit

Permalink
add select for parent to team form
Browse files Browse the repository at this point in the history
  • Loading branch information
KaydenLiss committed Jul 14, 2023
1 parent 1b99e5f commit 3d3f5f0
Show file tree
Hide file tree
Showing 31 changed files with 4,983 additions and 142 deletions.
20 changes: 10 additions & 10 deletions src/Controller/AssignController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function assignAudit(
AuditTomRepository $auditTomRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$audit = $auditTomRepository->find($request->get('id'));
if ($securityService->teamDataCheck($audit, $team) === false) {
return $this->redirectToRoute('audit_tom');
Expand All @@ -50,7 +50,7 @@ public function assignDataTransfer(
DatenweitergabeRepository $dataTransferRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$daten = $dataTransferRepository->find($request->get('id'));
if ($securityService->teamDataCheck($daten, $team) === false) {
return $this->redirectToRoute('datenweitergabe');
Expand All @@ -69,7 +69,7 @@ public function assignDsfa(
VVTDsfaRepository $impactAssessmentRepository
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$impactAssessment = $impactAssessmentRepository->find($request->get('id'));
if ($securityService->teamDataCheck($impactAssessment->getVvt(), $team)) {
$assignService->assignDsfa($request, $impactAssessment);
Expand All @@ -88,7 +88,7 @@ public function assignForm(
FormsRepository $formsRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$form = $formsRepository->find($request->get('id'));
if ($securityService->teamDataCheck($form, $team) === false) {
return $this->redirectToRoute('forms');
Expand All @@ -107,7 +107,7 @@ public function assignPolicy(
PoliciesRepository $policiesRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$policy = $policiesRepository->find($request->get('id'));
if ($securityService->teamDataCheck($policy, $team) === false) {
return $this->redirectToRoute('policies');
Expand All @@ -126,7 +126,7 @@ public function assignSoftware(
SoftwareRepository $softwareRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$software = $softwareRepository->find($request->get('id'));
if ($securityService->teamDataCheck($software, $team) === false) {
return $this->redirectToRoute('software');
Expand All @@ -145,7 +145,7 @@ public function assignTask(
TaskRepository $taskRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$task = $taskRepository->find($request->get('id'));
if ($securityService->teamDataCheck($task, $team) === false) {
return $this->redirectToRoute('tasks');
Expand All @@ -164,7 +164,7 @@ public function assignVorfall(
VorfallRepository $vorfallRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$vorfall = $vorfallRepository->find($request->get('id'));
if ($securityService->teamDataCheck($vorfall, $team) === false) {
return $this->redirectToRoute('vorfall');
Expand All @@ -183,7 +183,7 @@ public function assignVvt(
VVTRepository $vvtRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$vvt = $vvtRepository->find($request->get('id'));
if ($securityService->teamDataCheck($vvt, $team) === false) {
return $this->redirectToRoute('vvt');
Expand All @@ -206,7 +206,7 @@ public function index(CurrentTeamService $currentTeamService,
): Response
{
$user = $this->getUser();
$currentTeam = $currentTeamService->getTeamFromSession($user);
$currentTeam = $currentTeamService->getCurrentTeam($user);
$assignedDataTransfers = $transferRepository->findActiveByTeamAndUser($currentTeam, $user);
$assignedProcessings = $processingRepository->findActiveByTeamAndUser($currentTeam, $user);
$assignedAudits = $auditRepository->findActiveByTeamAndUser($currentTeam, $user);
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/AssistantController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function index(SecurityService $securityService,
CurrentTeamService $currentTeamService,
): RedirectResponse|Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if (!$securityService->teamCheck($team)) {
return $this->redirectToRoute('dashboard');
Expand All @@ -47,7 +47,7 @@ public function step(int $step,
EntityManagerInterface $entityManager,
): RedirectResponse|Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if (!$securityService->teamCheck($team)) {
return $this->redirectToRoute('dashboard');
Expand Down Expand Up @@ -148,7 +148,7 @@ public function select(Request $request,
AssistantService $assistantService,
) : Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
if ($securityService->teamCheck($team) === false) {
return $this->redirectToRoute('dashboard');
}
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/AuditTomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function addAuditTom(
AuditTomAbteilungRepository $auditTomAbteilungRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if ($securityService->teamCheck($team) === false) {
return $this->redirectToRoute('audit_tom');
Expand Down Expand Up @@ -106,7 +106,7 @@ public function cloneAuditTom(
AuditTomRepository $auditTomRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
if ($securityService->teamCheck($team) === false) {
return $this->redirectToRoute('audit_tom');
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public function editAuditTom(
AuditTomZieleRepository $auditTomZieleRepository,
)
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$audit = $auditTomRepository->find($request->get('tom'));

if ($securityService->teamDataCheck($audit, $team) === false) {
Expand Down Expand Up @@ -235,7 +235,7 @@ public function index(
AuditTomRepository $auditTomRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$audit = $auditTomRepository->findAllByTeam($team);

if ($securityService->teamCheck($team) === false) {
Expand Down
30 changes: 15 additions & 15 deletions src/Controller/BerichtController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function backupSoftware(
VVTRepository $vvtRepository,
)
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

$software = $softwareRepository->findBy(['team' => $team, 'activ' => true], ['createdAt' => 'DESC']);
$vvt = $vvtRepository->findActiveByTeam($team);
Expand Down Expand Up @@ -96,7 +96,7 @@ public function recoverySoftware(
SoftwareRepository $softwareRepository,
)
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$software = $softwareRepository->findBy(['team' => $team, 'activ' => true], ['createdAt' => 'DESC']);

if (count($software) < 1) {
Expand Down Expand Up @@ -130,7 +130,7 @@ public function report(
CurrentTeamService $currentTeamService,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

// Center Team authentication
if (!$team) {
Expand Down Expand Up @@ -174,7 +174,7 @@ public function reportAudit(

$req = $request->get('id');

$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if ($req) {
$audit = $auditTomRepository->findBy(array('id' => $req));
Expand Down Expand Up @@ -217,7 +217,7 @@ public function reportDataTransfer(
)
{
$id = $request->get('id');
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if ($id) {
$daten = $dataTransferRepository->findBy(['id'=>$id]);
Expand Down Expand Up @@ -265,7 +265,7 @@ public function reportDeletionConcept(
ini_set('max_execution_time', '900');
ini_set('memory_limit', '512M');

$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$doc = $this->translator->trans(id: 'deletionConcept.plural', domain: 'loeschkonzept');


Expand Down Expand Up @@ -301,7 +301,7 @@ public function reportGenerateReports(
ReportRepository $reportRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

$data = $request->get('report_export');
$qb = $reportRepository->createQueryBuilder('s');
Expand Down Expand Up @@ -407,7 +407,7 @@ public function reportGlobalTom(
AuditTomRepository $auditTomRepository,
)
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$audit = $auditTomRepository->findAllByTeam($team);

if (count($audit) < 1) {
Expand Down Expand Up @@ -444,7 +444,7 @@ public function reportIncident(
{
$id = $request->get('id');

$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if ($id) {
$daten = $vorfallRepository->findBy(['id'=>$id]);
Expand Down Expand Up @@ -486,7 +486,7 @@ public function reportPolicy(
)
{
$id = $request->get('id');
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if ($id) {
$policies = $policiesRepository->findBy(['id'=>$id]);
Expand Down Expand Up @@ -529,7 +529,7 @@ public function reportRequest(
{

$id = $request->get('id');
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if ($id) {
$clientRequest = $clientRequestRepository->findBy(['id'=>$id]);
Expand Down Expand Up @@ -570,7 +570,7 @@ public function reportSoftware(
)
{
$id = $request->get('id');
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if ($id) {
$software = $softwareRepository->findBy(['id'=>$id]);
Expand Down Expand Up @@ -612,7 +612,7 @@ public function reportTom(
{

$req = $request->get('id');
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());

if ($req) {
$tom = $tomRepository->findBy(array('id' => $req));
Expand Down Expand Up @@ -655,7 +655,7 @@ public function reportVvt(
ini_set('memory_limit', '512M');

$req = $request->get('id');
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$doc = $this->translator->trans(id: 'processing.directory', domain: 'vvt');

if ($req) {
Expand Down Expand Up @@ -697,7 +697,7 @@ public function reports(
ReportRepository $reportRepository,
)
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$users = $team->getMembers();

$members = [];
Expand Down
16 changes: 8 additions & 8 deletions src/Controller/ClientRequestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function allClientRequests(
ClientRequestRepository $clientRequestRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$client = $clientRequestRepository->findBy(['team' => $team, 'emailValid' => true]);

if ($securityService->teamCheck($team) === false) {
Expand Down Expand Up @@ -85,7 +85,7 @@ public function clientRequestComment(
$data = $request->get('client_request_comment');
$clientRequest = $clientRequestRepository->find($request->get('clientRequest'));

$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
if ($securityService->teamDataCheck($clientRequest, $team) === false) {
return $this->redirectToRoute('client_requests');
}
Expand All @@ -106,7 +106,7 @@ public function closeRequest(
{
$clientRequest = $clientRequestRepository->find($request->get('id'));
$user = $this->getUser();
$team = $currentTeamService->getTeamFromSession($user);
$team = $currentTeamService->getCurrentTeam($user);

if ($securityService->teamDataCheck($clientRequest, $team) && $securityService->adminCheck($user, $team)) {
$clientRequestService->closeRequest($clientRequest, $this->getUser());
Expand All @@ -129,7 +129,7 @@ public function editClientRequests(
)
{
$user = $this->getUser();
$team = $currentTeamService->getTeamFromSession($user);
$team = $currentTeamService->getCurrentTeam($user);
$clientRequest = $clientRequestRepository->find($request->get('id'));

if ($securityService->teamDataCheck($clientRequest, $team) && $securityService->adminCheck($user, $team)) {
Expand Down Expand Up @@ -217,7 +217,7 @@ public function internalNoteClientRequests(
ClientRequestRepository $clientRequestRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$clientRequest = $clientRequestRepository->find($request->get('id'));

if ($securityService->teamDataCheck($clientRequest, $team) === false) {
Expand Down Expand Up @@ -265,7 +265,7 @@ public function makeInternalRequest(
{
$clientRequest = $clientRequestRepository->find($request->get('id'));
$user = $this->getUser();
$team = $currentTeamService->getTeamFromSession($user);
$team = $currentTeamService->getCurrentTeam($user);

if ($securityService->teamDataCheck($clientRequest, $team) && $securityService->adminCheck($user, $team)) {
if ($clientRequestService->interalRequest($clientRequest)) {
Expand Down Expand Up @@ -345,7 +345,7 @@ public function showClientRequests(
ClientRequestRepository $clientRequestRepository,
): Response
{
$team = $currentTeamService->getTeamFromSession($this->getUser());
$team = $currentTeamService->getCurrentTeam($this->getUser());
$clientRequest = $clientRequestRepository->find($request->get('id'));

if ($securityService->teamDataCheck($clientRequest, $team) === false) {
Expand Down Expand Up @@ -427,7 +427,7 @@ public function validateUserRequest(
{
$clientRequest = $clientRequestRepository->find($request->get('id'));
$user = $this->getUser();
$team = $currentTeamService->getTeamFromSession($user);
$team = $currentTeamService->getCurrentTeam($user);

if ($securityService->teamDataCheck($clientRequest, $team) && $securityService->adminCheck($user, $team)) {
$clientRequestService->userValid($clientRequest, $user);
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function dashboard(Request $request,

// else get team for current user
$user = $this->getUser();
$currentTeam = $currentTeamService->getTeamFromSession($user);
$currentTeam = $currentTeamService->getCurrentTeam($user);

if ($currentTeam === null) {
if ($securityService->superAdminCheck($this->getUser())) {
Expand Down
Loading

0 comments on commit 3d3f5f0

Please sign in to comment.