Commit f4f8b5e9 authored by Open Source Developer's avatar Open Source Developer
Browse files

bug

parents 2679ba6d 2b4cba64
......@@ -12,3 +12,9 @@ casost.log_out_go:
_controller: '\Drupal\casost\Controller\CASLogout::logoutGo'
requirements:
_user_is_logged_in: 'TRUE'
casost.log_out_cas_go:
path: /cas/logoutcas
defaults:
_controller: '\Drupal\casost\Controller\CASLogout::logoutCasGo'
requirements:
_access: 'TRUE'
......@@ -123,7 +123,7 @@ class CASLogin extends ControllerBase
}
$attributes = phpCAS::getAttributes();
/*
/*
$isAllowed = true;
$att1 = $attributes[$this->allowed1];
$att2 = $attributes[$this->allowed2];
......@@ -150,8 +150,8 @@ class CASLogin extends ControllerBase
}
if (!$found1 || !$found2) {
$isAllowed = false;
}
}
if (!$isAllowed) {
$response = new Response();
$response->setContent(t('Access is allowed only to official school accounts'));
......@@ -302,4 +302,4 @@ class CASLogin extends ControllerBase
return false;
}
}
\ No newline at end of file
}
......@@ -10,6 +10,7 @@ use Drupal\user\Entity\User;
use Drupal\Core\Database\Connection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use phpCAS;
......@@ -38,11 +39,12 @@ class CASLogout extends ControllerBase
protected $connection;
public function __construct(
EntityTypeManagerInterface $entityTypeManager,
QueryFactory $entity_query,
Connection $connection,
LoggerChannelFactoryInterface $loggerChannel)
{
EntityTypeManagerInterface $entityTypeManager,
QueryFactory $entity_query,
Connection $connection,
LoggerChannelFactoryInterface $loggerChannel
) {
$this->entityTypeManager = $entityTypeManager;
$this->entity_query = $entity_query;
$this->connection = $connection;
......@@ -56,14 +58,13 @@ class CASLogout extends ControllerBase
$container->get('entity.query'),
$container->get('database'),
$container->get('logger.factory')
);
);
}
public function logoutGo(Request $request)
{
$configRowName = 'casost_sch_sso_config';
try {
$configRowId = $request->query->get('config');
if ($configRowId) {
$configRowName = $configRowName.'_'.$configRowId;
......@@ -116,10 +117,15 @@ class CASLogout extends ControllerBase
$user->setPassword(uniqid('pw'));
$user->save();
$response = new Response();
$response->setContent("{\"message\": \"Server logout successful\",\"next\": \"{$this->logoutRedirectUrl}\"}");
$response->setStatusCode(Response::HTTP_OK);
$response->headers->set('Content-Type', 'application/json');
// $response = new Response();
// $response->setContent("{\"message\": \"Server logout successful\",\"next\": \"{$this->logoutRedirectUrl}\"}");
// $response->setStatusCode(Response::HTTP_OK);
// $response->headers->set('Content-Type', 'application/json');
$response = (new JsonResponse([
"message" => "Server logout successful",
"next" => "{$this->logoutRedirectUrl}"
]))->setStatusCode(Response::HTTP_OK);
session_unset();
session_destroy();
......@@ -136,7 +142,57 @@ class CASLogout extends ControllerBase
}
}
private function redirectForbidden($configRowName, $errorCode) {
public function logoutCasGo(Request $request)
{
$configRowName = 'casost_sch_sso_config';
try {
$configRowId = $request->query->get('config');
if ($configRowId) {
$configRowName = $configRowName.'_'.$configRowId;
}
$CASOSTConfigs = $this->entityTypeManager->getStorage('casost_config')->loadByProperties(array('name' => $configRowName));
$CASOSTConfig = reset($CASOSTConfigs);
if ($CASOSTConfig) {
$this->serverVersion = $CASOSTConfig->serverversion->value;
$this->serverHostname = $CASOSTConfig->serverhostname->value;
$this->serverPort = $CASOSTConfig->serverport->value;
$this->serverUri = $CASOSTConfig->serveruri->value === null ? '' : $CASOSTConfig->serveruri->value;
$this->redirectUrl = $CASOSTConfig->redirecturl->value;
$this->changeSessionId = $CASOSTConfig->changesessionid->value;
$this->logoutRedirectUrl = $CASOSTConfig->logoutredirecturl->value;
$this->CASServerCACert = $CASOSTConfig->casservercacert->value;
$this->CASServerCNValidate = $CASOSTConfig->casservercnvalidate->value;
$this->noCASServerValidation = $CASOSTConfig->nocasservervalidation->value;
$this->proxy = $CASOSTConfig->proxy->value;
$this->handleLogoutRequests = $CASOSTConfig->handlelogoutrequests->value;
$this->CASLang = $CASOSTConfig->caslang->value;
$this->allowed1 = $CASOSTConfig->allowed1->value;
$this->allowed1Value = $CASOSTConfig->allowed1value->value;
$this->allowed2 = $CASOSTConfig->allowed2->value;
$this->allowed2Value = $CASOSTConfig->allowed2value->value;
} else {
return $this->redirectForbidden($configRowName, '7001');
}
$response = new Response();
$response->setContent("{\"message\": \"Server logout continue\",\"next\": \"{$this->logoutRedirectUrl}\"}");
$response->setStatusCode(Response::HTTP_OK);
$response->headers->set('Content-Type', 'application/json');
session_unset();
session_destroy();
\Drupal::service('page_cache_kill_switch')->trigger();
session_start();
return $response;
} catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return $this->redirectForbidden($configRowName, '8000');
}
}
private function redirectForbidden($configRowName, $errorCode)
{
session_unset();
session_destroy();
\Drupal::service('page_cache_kill_switch')->trigger();
......@@ -146,4 +202,4 @@ class CASLogout extends ControllerBase
return new RedirectResponseWithCookieExt($this->redirectUrl .'&error_code=' . $errorCode, 302, []);
}
}
}
\ No newline at end of file
}
......@@ -199,7 +199,7 @@ epal.ministry.retrievesettings:
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.storesettings:
path: '/ministry/store-settings/{capacityDisabled}/{directorViewDisabled}/{applicantsLoginDisabled}'
path: '/ministry/store-settings/{capacityDisabled}/{directorViewDisabled}/{applicantsLoginDisabled}/{applicantsResultsDisabled}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -268,5 +268,11 @@ epal.findcapacityperschool:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::FindCapacityPerSchool'
epal.applicant.creationpdf:
path: '/epal/pdf-application'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\PdfCreator::createApplicantPDF'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -68,6 +68,7 @@ class ApplicationSubmit extends ControllerBase {
], Response::HTTP_FORBIDDEN);
}
$student = array(
'langcode' => 'el',
'student_record_id' => 0,
......@@ -94,9 +95,10 @@ class ApplicationSubmit extends ControllerBase {
'certificatetype' => $applicationForm[0]['certificatetype'],
'graduation_year' => $applicationForm[0]['graduation_year'],
'lastschool_registrynumber' => $applicationForm[0]['lastschool_registrynumber'],
'lastschool_unittypeid' => $applicationForm[0]['lastschool_unittypeid'],
'lastschool_schoolname' => $applicationForm[0]['lastschool_schoolname'],
'lastschool_schoolyear' => $applicationForm[0]['lastschool_schoolyear'],
'lastschool_class' => $applicationForm[0]['lastschool_class'],
'currentepal' => $applicationForm[0]['currentepal'],
'currentclass' => $applicationForm[0]['currentclass'],
'guardian_name' => $applicationForm[0]['cu_name'],
'guardian_surname' => $applicationForm[0]['cu_surname'],
......@@ -111,6 +113,22 @@ class ApplicationSubmit extends ControllerBase {
return $this->respondWithStatus([
"error_code" => $errorCode ], Response::HTTP_OK);
}
$lastSchoolRegistryNumber = $student['lastschool_registrynumber'];
$lastSchoolYear = (int)(substr($student['lastschool_schoolyear'], -4));
if ((int)date("Y") === $lastSchoolYear && (int)$student['lastschool_unittypeid'] === 5) {
$epalSchools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $lastSchoolRegistryNumber));
$epalSchool = reset($epalSchools);
if (!$epalSchool){
return $this->respondWithStatus([
"error_code" => 4004
], Response::HTTP_FORBIDDEN);
} else {
$student['currentepal'] = $epalSchool->id();
}
} else {
$student['currentepal'] = 0;
}
$entity_storage_student = $this->entityTypeManager->getStorage('epal_student');
$entity_object = $entity_storage_student->create($student);
$entity_storage_student->save($entity_object);
......@@ -176,6 +194,9 @@ class ApplicationSubmit extends ControllerBase {
if(!$student["agreement"]) {
return 1001;
}
if(!$student["lastschool_schoolyear"] || strlen($student["lastschool_schoolyear"]) !== 9) {
return 1002;
}
return 0;
}
}
......@@ -75,15 +75,9 @@ class Distribution extends ControllerBase {
public function createDistribution(Request $request) {
//$this->findSmallClasses();
//return;
$numDistributions = 3;
$sizeOfBlock = 100000;
//POST method is checked
if (!$request->isMethod('POST')) {
return $this->respondWithStatus([
......@@ -114,11 +108,12 @@ class Distribution extends ControllerBase {
'message' => t("User Invalid Role"),
], Response::HTTP_FORBIDDEN);
}
//check where distribution can be done now ($capacityDisabled / $directorViewDisabled settings)
$capacityDisabled = false;
$directorViewDisabled = false;
//check where distribution can be done now ($capacityDisabled / $directorViewDisabled settings)
$capacityDisabled = "0";
$directorViewDisabled = "0";
$applicantsResultsDisabled = "0";
$config_storage = $this->entityTypeManager->getStorage('epal_config');
$epalConfigs = $config_storage->loadByProperties(array('id' => 1));
$epalConfig = reset($epalConfigs);
......@@ -130,8 +125,9 @@ class Distribution extends ControllerBase {
else {
$capacityDisabled = $epalConfig->lock_school_capacity->getString();
$directorViewDisabled = $epalConfig->lock_school_students_view->getString();
$applicantsResultsDisabled = $epalConfig->lock_results->getString();
}
if ($capacityDisabled === "0" or $directorViewDisabled === "0") {
if ($capacityDisabled === "0" || $directorViewDisabled === "0" || $applicantsResultsDisabled === "0") {
return $this->respondWithStatus([
'message' => t("capacityDisabled and / or directorViewDisabled settings are false"),
], Response::HTTP_FORBIDDEN);
......@@ -140,22 +136,26 @@ class Distribution extends ControllerBase {
$transaction = $this->connection->startTransaction();
try {
//initialize/empty epal_student_class if there are already data in it!
//$this->connection->delete('epal_student_class')->execute();
$this->initializeResults();
if ($this->initializeResults() === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in initializeResults function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
//$limitUp_class = $this->retrieveCapacityLimitUp("Α");
$limitUp_class = $this->retrieveCapacityLimitUp("1");
if ($limitUp_class = $this->retrieveCapacityLimitUp("1") === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in retrieveCapacityLimitUp function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
//print_r("<br> ΑΝΩΤΑΤΟ ΟΡΙΟ ΜΑΘΗΤΩΝ: " . $limitUp_class);
while ($this->choice_id <= $numDistributions) {
//print_r("<br>ΠΕΡΑΣΜΑ: " . $this->choice_id);
//υπολογισμός πλήθους non-finalized αιτήσεων για να καθοριστεί ο αριθμός των fetches που θα κάνουμε με συγκεκριμένο sizeOfBlock
if ($this->choice_id === 1) {
$sCon = $this->connection->select('epal_student', 'eStudent')
......@@ -176,7 +176,10 @@ class Distribution extends ControllerBase {
->condition('eStudent.id', $j*$sizeOfBlock, '<=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$this->locateStudent($this->choice_id, $epalStudents);
if ($this->locateStudent($this->choice_id, $epalStudents) === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in locateStudent function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
$num = $num + sizeof($epalStudents);
$j = $j + 1;
......@@ -190,7 +193,11 @@ class Distribution extends ControllerBase {
->condition('eStudent.id', $this->pendingStudents, 'IN');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$this->locateStudent($this->choice_id, $epalStudents);
if ($this->locateStudent($this->choice_id, $epalStudents) === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in locateStudent function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
else { //αν δεν υπάρχουν εκκρεμότητες, μην συνεχίζεις με άλλο πέρασμα
break;
......@@ -207,14 +214,20 @@ class Distribution extends ControllerBase {
foreach ($eepalSchools as $eepalSchool) {
$this->checkCapacityAndArrange($eepalSchool->id, "1", "-1", $limitUp_class, $eepalSchool->capacity_class_a);
if ($this->checkCapacityAndArrange($eepalSchool->id, "1", "-1", $limitUp_class, $eepalSchool->capacity_class_a) === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in checkCapacityAndArrange function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
$sCon = $this->connection->select('eepal_sectors_in_epal_field_data', 'eSchool')
->fields('eSchool', array('epal_id', 'sector_id', 'capacity_class_sector'))
->condition('eSchool.epal_id', $eepalSchool->id, '=');
$eepalSectorsInEpal = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($eepalSectorsInEpal as $eepalSecInEp) {
$this->checkCapacityAndArrange($eepalSchool->id, "2", $eepalSecInEp->sector_id, $limitUp_class, $eepalSecInEp->capacity_class_sector);
if ($this->checkCapacityAndArrange($eepalSchool->id, "2", $eepalSecInEp->sector_id, $limitUp_class, $eepalSecInEp->capacity_class_sector) === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in checkCapacityAndArrange function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool')
......@@ -222,10 +235,17 @@ class Distribution extends ControllerBase {
->condition('eSchool.epal_id', $eepalSchool->id, '=');
$eepalSpecialtiesInEpal = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($eepalSpecialtiesInEpal as $eepalSpecialInEp) {
$this->checkCapacityAndArrange($eepalSchool->id, "3", $eepalSpecialInEp->specialty_id, $limitUp_class, $eepalSpecialInEp->capacity_class_specialty);
//Γ' Λυκείου
if ($this->checkCapacityAndArrange($eepalSchool->id, "3", $eepalSpecialInEp->specialty_id, $limitUp_class, $eepalSpecialInEp->capacity_class_specialty) === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in checkCapacityAndArrange function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
//Δ' Λυκείου
if ($eepalSchool->operation_shift === "ΕΣΠΕΡΙΝΟ") {
$this->checkCapacityAndArrange($eepalSchool->id, "4", $eepalSpecialInEp->specialty_id, $limitUp_class, $eepalSpecialInEp->capacity_class_specialty);
if ($this->checkCapacityAndArrange($eepalSchool->id, "4", $eepalSpecialInEp->specialty_id, $limitUp_class, $eepalSpecialInEp->capacity_class_specialty) === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in checkCapacityAndArrange function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
......@@ -235,7 +255,18 @@ class Distribution extends ControllerBase {
} //end while
$this->findSmallClasses();
if ($this->findSmallClasses() === ERROR_DB) {
return $this->respondWithStatus([
"message" => t("Unexpected Error in findSmallClasses function AFTER initial Distribution!")
], Response::HTTP_INTERNAL_SERVER_ERROR);
//αν αποτύχει, δεν γίνεται rollback. --> Λύση: διαγρα΄φή των όποιων αποτελεσμάτων
if ($this->initializeResults() === ERROR_DB)
return $this->respondWithStatus([
"message" => t("Unexpected Error in initializeResults function AFTER findSmallClasses call Function")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
} //end try
......@@ -251,7 +282,7 @@ class Distribution extends ControllerBase {
if ($content = $request->getContent()) {
$postData = json_decode($content);
return $this->respondWithStatus([
'message' => "Distribution has made successfu",
'message' => "Distribution has made successfully",
], Response::HTTP_OK);
}
else {
......@@ -340,14 +371,10 @@ class Distribution extends ControllerBase {
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
$transaction->rollback();
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during locateStudent Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
return ERROR_DB;
}
return $this->respondWithStatus([
"message" => t("locateStudent Method of Distribution has made successfully")
], Response::HTTP_OK);
return SUCCESS;
}
......@@ -366,9 +393,7 @@ class Distribution extends ControllerBase {
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
$transaction->rollback();
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during retrieveCapacityLimitUp Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
return ERROR_DB;
}
return $row->limit_up;
......@@ -394,43 +419,14 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
->condition('studentClass.specialization_id', $secCourId, '=');
$epalStudentClass = $clCon->execute()->fetchAll(\PDO::FETCH_OBJ);
//print_r("<br> ΣΧΟΛΕΙΟ: " . $epalId . " ΤΑΞΗ: " . $classId . " ΤΟΜΕΑΣ/ΕΙΔΙΚΟΤΗΤΑ: " . $secCourId . " ΧΩΡΗΤΙΚΟΤΗΤΑ: " . sizeof($epalStudentClass));
//ΕΠΙΠΛΕΟΝ ΕΠΙΠΕΔΟ ΑΣΦΑΛΕΙΑΣ: αν δεν υπάρχει ο συγκεκριμένος τομέας/ειδικότητα στο σχολείο
//ο μαθητής που τοποθετήθηκε με την locateStudent να διαγραφεί
//Σημείωση: κανονικά κάτι τέτοιο δεν μπορεί να συμβεί από το front-end (δηλ. μαθητής να δηλώσει τομέα/ειδικότητα που δεν προσφέρεται..)
//ΑΝ ΜΠΕΙ ΠΡΕΠΕΙ ΝΑ ΕΝΣΩΜΑΤΩΘΕΙ ΣΤΗΝ LOCATESTUDENT..
/*
if (sizeof($epalStudentClass) === 0) {
//print_r("<br>ΜΠΗΚΑ! ");
foreach ($epalStudentClass as $epalStudCl) {
//print_r("<br>ΜΠΗΚΑ! ΜΑΘΗΤΗΣ: " . $epalStudCl->student_id);
$query = $this->connection->delete('epal_student_class')
->condition('student_id', $epalStudCl->student_id)
->execute();
}
}
*/
//ΤΕΛΟΣ
$limit = $limitup * $capacity;
if (sizeof($epalStudentClass) > $limit) {
//print_r("<br>ΥΠΕΡΧΕΙΛΙΣΗ!");
foreach ($epalStudentClass as $epalStudCl) {
//foreach ($epalStudentClass as $epalStudCl) {
//Υπολογισμός μορίων του μαθητή και (πιθανή) αποθήκευσή τους
//ΣΗΜΕΙΩΣΗ: Ο υπoλογισμός γίνεται στο front-end
//$points = $this->calculatePoints();
/*
$query = $this->connection->update('epal_student');
$query->fields([
'points' =>$points,
]);
$query->condition('id',$epalStudCl->student_id);
$query->execute();
*/
}
//}
$this->makeSelectionOfStudents($epalStudentClass,$limit);
}
else { //αφαίρεσε όσους μαθητές βρίσκονται στον πίνακα εκκρεμοτήτων
......@@ -446,14 +442,10 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
$transaction->rollback();
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during checkCapacityAndArrange Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
return ERROR_DB;
}
return $this->respondWithStatus([
"message" => t("checkCapacityAndArrange Method of Distribution has made successfully")
], Response::HTTP_OK);
return SUCCESS;
}
......@@ -578,17 +570,13 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
$transaction->rollback();
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during DELETE proccess in makeSelectionOfStudents Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
return ERROR_DB;
}
} //end if currentepal
} //end foreach
} //endif newlimit
return $this->respondWithStatus([
"message" => t("makeSelectionOfStudents Method of Distribution has made successfully")
], Response::HTTP_OK);
return SUCCESS;
} //end function
......@@ -618,10 +606,9 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
}
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during initializeResults Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
return ERROR_DB;
}
return SUCCESS;
}
......@@ -695,6 +682,8 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
} //end for each school/department
return SUCCESS;
} //end function
......
......@@ -94,7 +94,8 @@ class InformUnlocatedStudents extends ControllerBase {
// εύρεση μαθητών που η αίτησή τους ΔΕΝ ικανοποιήθηκε
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('student_id'));
->fields('eStudent', array('student_id'))
->condition('eStudent.finalized', 0 , '=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$studentIds = array();
......@@ -224,7 +225,8 @@ class InformUnlocatedStudents extends ControllerBase {
// εύρεση μαθητών που η αίτησή τους ΙΚΑΝΟΠΟΙΗΘΗΚΕ
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('student_id', 'epal_id'));
->fields('eStudent', array('student_id', 'epal_id'))
->condition('eStudent.finalized', 1 , '=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$studentIds = array();
......
......@@ -98,6 +98,7 @@ class MinisterSettings extends ControllerBase {
$capacityDisabled = $epalConfig->lock_school_capacity->getString();
$directorViewDisabled = $epalConfig->lock_school_students_view->getString();
$applicantsLoginDisabled = $epalConfig->lock_application->getString();
$applicantsResultsDisabled = $epalConfig->lock_results->getString();
}
$config_storage->resetCache();
......@@ -107,6 +108,7 @@ class MinisterSettings extends ControllerBase {
'capacityDisabled' => $capacityDisabled,
'directorViewDisabled' => $directorViewDisabled,
'applicantsLoginDisabled' => $applicantsLoginDisabled,
'applicantsResultsDisabled' => $applicantsResultsDisabled,
], Response::HTTP_OK);
} //end try
......@@ -123,7 +125,7 @@ class MinisterSettings extends ControllerBase {
}
public function storeSettings(Request $request, $capacityDisabled, $directorViewDisabled, $applicantsLoginDisabled ) {
public function storeSettings(Request $request, $capacityDisabled, $directorViewDisabled, $applicantsLoginDisabled, $applicantsResultsDisabled ) {
try {
if (!$request->isMethod('GET')) {
......@@ -168,6 +170,7 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
$epalConfig->set('lock_school_capacity', $capacityDisabled);
$epalConfig->set('lock_school_students_view', $directorViewDisabled);
$epalConfig->set('lock_application', $applicantsLoginDisabled);
$epalConfig->set('lock_results', $applicantsResultsDisabled);
$epalConfig->save();
}
$config_storage->resetCache();
......@@ -178,6 +181,7 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
'capacityDisabled' => $capacityDisabled,
'directorViewDisabled' => $directorViewDisabled,
'applicantsLoginDisabled' => $applicantsLoginDisabled,
'applicantsResultsDisabled' => $applicantsResultsDisabled,
], Response::HTTP_OK);
} //end try
......
......@@ -21,19 +21,18 @@ class MinistryLogin extends ControllerBase
//protected $connection;