...
 
Commits (9)
......@@ -217,11 +217,18 @@ class CASLogin extends ControllerBase
$schools = $this->entityTypeManager->getStorage('gel_school')->loadByProperties(array('registry_no' => $registry_no));
$school = reset($schools);
if ($school) {
if ($school->unit_type_id->value =="3"){
if (($school->unit_type_id->value ==="3" )&&($school->extra_unitid->value !=="200")){
return array("id" => $school->id(), "exposedRole" => "director_gym", "internalRole" => "gym");
}
elseif (($school->unit_type_id->value ==="3") && ($school->extra_unitid->value ==="200"))
{
return array("id" => $school->id(), "exposedRole" => "director_gymlt", "internalRole" => "gymlt");
}
else{
return array("id" => $school->id(), "exposedRole" => "director_gel", "internalRole" => "gel");
return array("id" => $school->id(), "exposedRole" => "director_gel", "internalRole" => "gel");
}
}
$eduAdmins = $this->entityTypeManager->getStorage('eepal_admin_area')->loadByProperties(array('registry_no' => $registry_no));
......
This diff is collapsed.
......@@ -216,7 +216,7 @@ class PDFCreator extends ControllerBase {
$this->pdf->SetFont($this->fontLight, '', 11);
//if ($this->applicantsResultsDisabled === "1")
if ($status === "0" || $status === "3" || $status === "4")
if ($status === "0" || $status === "3" || $status === "4" || $status === "5" || $status === "6" || $status === "7")
$this->pdf->MultiCell(0, 8, $this->prepareString('(Αρχική)'), 0, 'R');
else
$this->pdf->MultiCell(0, 8, $this->prepareString('(Οριστική)'), 0, 'R');
......
......@@ -2273,7 +2273,8 @@ class ReportsCreator extends ControllerBase
->fields('eStudent', array('name','studentsurname','regionaddress', 'regiontk', 'regionarea','telnum'))
->condition('eStudent.id', $epalStudentClass->student_id, '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eStudent.myschool_promoted', 2 , '<=');
->condition('eStudent.myschool_promoted', 2 , '<=')
->condition('eStudent.myschool_promoted', 1 , '>=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($epalStudents as $epalStudent) {
array_push($idColumn, $epalStudentClass->student_id);
......@@ -2329,7 +2330,8 @@ class ReportsCreator extends ControllerBase
->fields('eStudent', array('name','studentsurname','regionaddress', 'regiontk', 'regionarea','telnum'))
->condition('eStudent.delapp', 0 , '=')
->condition('eStudent.id', $epalStudentClass->student_id, '=')
->condition('eStudent.myschool_promoted', 2 , '<=');
->condition('eStudent.myschool_promoted', 2 , '<=')
->condition('eStudent.myschool_promoted', 1 , '>=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($epalStudents as $epalStudent) {
array_push($idColumn, $epalStudentClass->student_id);
......@@ -2375,7 +2377,8 @@ class ReportsCreator extends ControllerBase
->fields('eStudent', array('name','studentsurname','regionaddress', 'regiontk', 'regionarea','telnum'))
->condition('eStudent.delapp', 0 , '=')
->condition('eStudent.id', $epalStudentClass->student_id, '=')
->condition('eStudent.myschool_promoted', 2 , '<=');
->condition('eStudent.myschool_promoted', 2 , '<=')
->condition('eStudent.myschool_promoted', 1 , '>=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($epalStudents as $epalStudent) {
array_push($idColumn, $epalStudentClass->student_id);
......@@ -2421,7 +2424,8 @@ class ReportsCreator extends ControllerBase
->fields('eStudent', array('name','studentsurname','regionaddress', 'regiontk', 'regionarea','telnum'))
->condition('eStudent.delapp', 0 , '=')
->condition('eStudent.id', $epalStudentClass->student_id, '=')
->condition('eStudent.myschool_promoted', 2 , '<=');
->condition('eStudent.myschool_promoted', 2 , '<=')
->condition('eStudent.myschool_promoted', 1 , '>=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($epalStudents as $epalStudent) {
array_push($idColumn, $epalStudentClass->student_id);
......@@ -2487,6 +2491,7 @@ class ReportsCreator extends ControllerBase
], Response::HTTP_FORBIDDEN);
}
$schoolid = $user->init->value;
//$schoolid = 2792;
//user role validation
$roles = $user->getRoles();
......@@ -2537,7 +2542,8 @@ class ReportsCreator extends ControllerBase
->fields('eStudent', array('id', 'name', 'studentsurname','regionaddress', 'regiontk', 'regionarea','telnum','directorconfirm'))
->condition('eStudent.id', $gelClass->student_id, '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eStudent.myschool_promoted', 2 , '<=');
->condition('eStudent.myschool_promoted', 2 , '<=')
->condition('eStudent.myschool_promoted', 1 , '>=');
$gelStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($gelStudents as $gelStudent) {
array_push($idColumn, $gelStudent->id);
......@@ -2587,6 +2593,7 @@ class ReportsCreator extends ControllerBase
->fields('eStudent', array('id', 'name', 'studentsurname','regionaddress', 'regiontk', 'regionarea','telnum','directorconfirm'))
->condition('eStudent.lastschool_registrynumber', $gelSchool->registry_no , '=')
->condition('eStudent.myschool_promoted', 2 , '<=')
->condition('eStudent.myschool_promoted', 1 , '>=')
->condition('eStudent.delapp', 0 , '=')
->condition('eStudent.nextclass', $k, '=');
......
......@@ -589,8 +589,10 @@ class SubmitedApplications extends ControllerBase
else if ($applicantsResultsDisabled === "0" && ($es->myschool_promoted === "6" || $es->myschool_promoted === "7") )
$status = "5";
else if ($applicantsResultsDisabled === "0" && $es->myschool_promoted != "1" && $es->myschool_promoted != "2"
&& $es->myschool_promoted != "6" && $es->myschool_promoted != "7")
&& $es->myschool_promoted != "6" && $es->myschool_promoted != "7" && $es->myschool_promoted != "0")
$status = "6";
else if ($applicantsResultsDisabled === "0" && $es->myschool_promoted === "0" )
$status = "7";
else
$status = "0";
......
......@@ -542,8 +542,10 @@ class GelSubmittedApplications extends ControllerBase
else if ($applicantsResultsDisabled === "0" && ($gelStudent->myschool_promoted === "6" || $gelStudent->myschool_promoted === "7") )
$status = "5";
else if ($applicantsResultsDisabled === "0" && $gelStudent->myschool_promoted != "1" && $gelStudent->myschool_promoted != "2"
&& $gelStudent->myschool_promoted != "6" && $gelStudent->myschool_promoted != "7")
&& $gelStudent->myschool_promoted != "6" && $gelStudent->myschool_promoted != "7" && $gelStudent->myschool_promoted != "0")
$status = "6";
else if ($applicantsResultsDisabled === "0" && $gelStudent->myschool_promoted === "0" )
$status = "7";
else
$status = "0";
......
......@@ -190,7 +190,7 @@ class PDFCreator extends ControllerBase {
$this->pdf->SetFont($this->fontLight, '', 11);
//if ($this->applicantsResultsDisabled === "1")
if ($status === "0" || $status === "4")
if ($status === "0" || $status === "2" || $status === "3" || $status === "5" || $status === "6" || $status === "7")
$this->pdf->MultiCell(0, 8, $this->prepareString('(Αρχική)'), 0, 'R');
else
$this->pdf->MultiCell(0, 8, $this->prepareString('(Οριστική)'), 0, 'R');
......
......@@ -71,7 +71,7 @@ class CurrentUser extends ControllerBase
$userRoles = $user->getRoles();
foreach ($userRoles as $userRole) {
if (($userRole === 'epal') ||($userRole === 'gel') || ($userRole === 'regioneduadmin') || ($userRole === 'eduadmin') || ($userRole === 'gym')) {
if (($userRole === 'epal') ||($userRole === 'gel') || ($userRole === 'regioneduadmin') || ($userRole === 'eduadmin') || ($userRole === 'gym') || ($userRole === 'gymlt')) {
return $this->respondWithStatus([
'cu_name' => $user->mail->value,
'cu_surname' => '',
......@@ -162,7 +162,7 @@ class CurrentUser extends ControllerBase
public function getApplicantUserData(Request $request)
{
//test
//for ($k=0;$k<2;$k++)
//for ($k=0;$k<14;$k++)
// $this->logger->warning(\Drupal::service('uuid')->generate() );
$authToken = $request->headers->get('PHP_AUTH_USER');
......
No preview for this file type
......@@ -46,6 +46,7 @@ import { LoaderService } from "./services/Spinner.service";
import SchoolGymAuthGuard from "./guards/schoolgym.auth.guard";
import * as $ from "jquery";
class MyLocalization extends NgLocalization {
......@@ -101,7 +102,8 @@ class MyLocalization extends NgLocalization {
DidepdeAuthGuard,
MinistryAuthGuard,
ReportsAuthGuard,
SchoolGymAuthGuard
SchoolGymAuthGuard,
]
})
class AppModule { }
......
......@@ -56,7 +56,7 @@ import { HelperDataService } from "../../services/helper-data-service";
<!--<p style="margin-top: 20px; line-height: 2em;">Παρακαλούμε επιβεβαιώσετε με Ναι ή Όχι την αίτηση του κάθε μαθητή. </p>-->
<div class="row">
<div class="col-md-10" style="font-weight: bold;"> Τα τμήματα του σχολείου σας.</div>
<div class="col-md-10" style="font-weight: bold;"> Οι τάξεις του σχολείου σας.</div>
<div class="col-md-2" style="font-weight: bold;"> <span class="pull-right" style="text-align: right; padding-right: 2px;">Αριθμός Μαθητών</span></div>
</div>
<div *ngFor="let CoursesPerSchools$ of CoursesPerSchool$ | async; let i=index; let isOdd=odd; let isEven=even" >
......
......@@ -71,6 +71,7 @@ import { LocalDataSource } from "ng2-smart-table";
}
ngOnInit() {
this.validCreator = 0;
this.showLoader.next(true);
......
......@@ -16,7 +16,7 @@ import { OrientationGroupActions } from "../../actions/orientationgroup.action";
import { LangCourseFieldsActions } from "../../actions/langcoursesfields.actions";
import { GelStudentDataFieldsActions } from "../../actions/gelstudentdatafields.actions";
import { DIDE_ROLE, MINISTRY_ROLE, PDE_ROLE, SCHOOL_ROLE, STUDENT_ROLE, SCHOOLGEL_ROLE, SCHOOLGYM_ROLE } from "../../constants";
import { DIDE_ROLE, MINISTRY_ROLE, PDE_ROLE, SCHOOL_ROLE, STUDENT_ROLE, SCHOOLGEL_ROLE, SCHOOLGYM_ROLE, SCHOOLGYMLT_ROLE} from "../../constants";
import { HelperDataService } from "../../services/helper-data-service";
import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state";
import { ILoginInfoRecords } from "../../store/logininfo/logininfo.types";
......@@ -118,7 +118,7 @@ export default class HeaderComponent implements OnInit, OnDestroy {
this.showLoader$.next(true);
this._hds.signOut().then(data => {
this._ata.initLoginInfo();
if (this.authRole === SCHOOL_ROLE || this.authRole === SCHOOLGEL_ROLE || this.authRole === SCHOOLGYM_ROLE) {
if (this.authRole === SCHOOL_ROLE || this.authRole === SCHOOLGEL_ROLE || this.authRole === SCHOOLGYM_ROLE || this.authRole === SCHOOLGYMLT_ROLE) {
this.authToken = "";
this.authRole = "";
window.location.assign((<any>data).next);
......@@ -160,7 +160,7 @@ export default class HeaderComponent implements OnInit, OnDestroy {
}
goHome() {
if (this.authRole === SCHOOL_ROLE || this.authRole === SCHOOLGEL_ROLE || this.authRole === SCHOOLGYM_ROLE) {
if (this.authRole === SCHOOL_ROLE || this.authRole === SCHOOLGEL_ROLE || this.authRole === SCHOOLGYM_ROLE || this.authRole === SCHOOLGYMLT_ROLE) {
this.router.navigate(["/school"]);
}
else if (this.authRole === PDE_ROLE) {
......
......@@ -33,18 +33,18 @@
</div>
<div *ngIf="(loginInfo$ | async).size > 0 " class="nav-item" >
<li *ngIf="authRole=='director_gym'" class="nav-item">
<li *ngIf="(authRole=='director_gym') || (authRole=='director_gymlt')" class="nav-item">
<a class="nav-link" [routerLink]="['/school/directorgym-view']" [routerLinkActive]="['active']"><b>Λίστα Μαθητών</b></a>
</li>
</div>
<div *ngIf="(loginInfo$ | async).size > 0 " class="nav-item" >
<li *ngIf="authRole=='director_gel'" class="nav-item">
<li *ngIf="(authRole=='director_gel') || (authRole=='director_gymlt') " class="nav-item">
<a class="nav-link" [routerLink]="['/school/directorgel-view']" [routerLinkActive]="['active']"><b>Δηλώσεις Μαθητών</b></a>
</li>
</div>
<div *ngIf="(loginInfo$ | async).size > 0 " class="nav-item" >
<li *ngIf="authRole=='director_gel'" class="nav-item">
<li *ngIf="(authRole=='director_gel') || (authRole=='director_gymlt')" class="nav-item">
<a class="nav-link" [routerLink]="['/school/directorgel-reports']" [routerLinkActive]="['active']"><b>Αναφορές</b></a>
</li>
</div>
......
......@@ -159,13 +159,17 @@ export default class SchoolHome implements OnInit, OnDestroy {
}
else if (this.authRole === "director_gel")
{
this.router.navigate(["/school/directorgel-view"]); }
else if (this.authRole === "director_gym")
this.router.navigate(["/school/directorgel-view"]);
}
else if (this.authRole === "director_gym" || this.authRole === "director_gymlt" )
{
this.router.navigate(["/school/directorgym-view"]); }
this.router.navigate(["/school/directorgym-view"]);
}
else if (this.authRole === "pde")
{
this.router.navigate(["/school/perfecture-view"]); }
this.router.navigate(["/school/perfecture-view"]);
}
else if (this.authRole === "dide")
this.router.navigate(["/school/school-type-selection"]);
......
......@@ -195,6 +195,7 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
private disclaimer_checked: number;
private hasright: number;
private app_update: BehaviorSubject<boolean>;
private apptype: BehaviorSubject<string>;
private appId: BehaviorSubject<string>;
private previousClass: BehaviorSubject<string>;
private previousSector: BehaviorSubject<string>;
......@@ -234,6 +235,7 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
this.showLoader = new BehaviorSubject(false);
this.app_update = new BehaviorSubject(false);
this.appId = new BehaviorSubject("");
this.apptype = new BehaviorSubject("epal");
this.previousClass = new BehaviorSubject("");
this.previousSector = new BehaviorSubject("");
......@@ -301,6 +303,7 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
if (datamode.get("app_update") === true) {
this.app_update.next(true);
this.appId.next(datamode.get("appid"));
this.apptype.next(datamode.get("apptype"));
this.previousClass.next(datamode.get("currentclass"));
this.previousSector.next(datamode.get("sector_id"));
this.previousCourse.next(datamode.get("course_id"));
......@@ -420,6 +423,23 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
submitNow(newapp) {
//not allowed to edit application targeted to other school type (epal)
if (this.app_update.getValue() && this.apptype.getValue() != "epal")
{
console.log("Error: trying to edit application in different schooltype.");
let mTitle = "Αποτυχία τροποποίησης αίτησης";
let mText = "Δεν έχετε δικαίωμα να τροποποιήσετε αίτηση για άλλο τύπο σχολείου. " +
"Παρακαλώ σε περίπτωση που θέλετε να κάνετε Νέα Αίτηση, πατήστε την επιλογή 'Νέα' που βρίσκετε πάνω αριστερά στην οθόνη της εφαρμογής.";
let mHeader = "modal-header-danger";
this.modalTitle.next(mTitle);
this.modalText.next(mText);
this.modalHeader.next(mHeader);
this.showModal();
(<any>$(".loading")).remove();
this.showLoader.next(false);
return;
}
//έλεγχος αν πρέπει να γίνει έλεγχος πληρότητας
let nonCheckOccupancy = "$";
if (newapp === false) {
......
......@@ -216,6 +216,7 @@ import { StudentGelCourseChosen } from "../students/student";
private hasright: number;
private app_update: BehaviorSubject<boolean>;
private appId: BehaviorSubject<string>;
private apptype: BehaviorSubject<string>;
//private wsIdentSub: Subscription;
private wsEnabled: BehaviorSubject<number>;
private limitSchoolYear: string;
......@@ -252,6 +253,7 @@ import { StudentGelCourseChosen } from "../students/student";
this.showLoader = new BehaviorSubject(false);
this.app_update = new BehaviorSubject(false);
this.appId = new BehaviorSubject("");
this.apptype = new BehaviorSubject("gel");
this.orientationSelected = new BehaviorSubject(-1);
this.classSelected = new BehaviorSubject(-1);
this.wsEnabled = new BehaviorSubject(-1);
......@@ -311,6 +313,7 @@ import { StudentGelCourseChosen } from "../students/student";
if (datamode.get("app_update") === true) {
this.app_update.next(true);
this.appId.next(datamode.get("appid"));
this.apptype.next(datamode.get("apptype"));
}
return datamode;
}, {});
......@@ -423,6 +426,24 @@ import { StudentGelCourseChosen } from "../students/student";
if (this.gelstudentDataFields$.getValue().size === 0 || this.gelclasses$.getValue().size === 0 || this.loginInfo$.getValue().size === 0)
return;
//not allowed to edit application targeted to other school type (gel)
if (this.app_update.getValue() && this.apptype.getValue() != "gel")
{
console.log("Error: trying to edit application in different schooltype.");
let mTitle = "Αποτυχία τροποποίησης αίτησης";
let mText = "Δεν έχετε δικαίωμα να τροποποιήσετε αίτηση για άλλο τύπο σχολείου. " +
"Παρακαλώ σε περίπτωση που θέλετε να κάνετε Νέα Αίτηση, πατήστε την επιλογή 'Νέα' που βρίσκετε πάνω αριστερά στην οθόνη της εφαρμογής.";
let mHeader = "modal-header-danger";
this.modalTitle.next(mTitle);
this.modalText.next(mText);
this.modalHeader.next(mHeader);
this.showModal();
(<any>$(".loading")).remove();
this.showLoader.next(false);
return;
}
let aitisiObj: Array<any> = [];
let std = this.gelstudentDataFields$.getValue().get(0);
//aitisiObj[0]: στοιχεία μαθητών
......
......@@ -142,6 +142,12 @@ import { IAppState } from "../../store/store";
Σε περίπτωση προαγωγής σας τις αμέσως επόμενες ημέρες θα τοποθετηθείτε σε σχολείο χωρίς καμία δική σας περαιτέρω ενέργεια.<br><br>
</div>
</div>
<div *ngIf = "GelStudentDetails$.status == '7' " >
<div class="col-md-12" style="font-size: 1.0em; color: #a52a2a; font-weight: bold;">
Το αποτέλεσμα της προαγωγής σας δεν έχει καταχωρισθεί στo πληροφοριακό σύστημα του σχολείου (myschool).
Παρακαλώ επικοινωνήστε με τον διευθυντή του σχολείου σας.<br><br>
</div>
</div>
</div>
......@@ -350,6 +356,12 @@ import { IAppState } from "../../store/store";
Σε περίπτωση προαγωγής σας τις αμέσως επόμενες ημέρες θα τοποθετηθείτε σε σχολείο χωρίς καμία δική σας περαιτέρω ενέργεια.<br><br>
</div>
</div>
<div *ngIf = "StudentDetails$.status == '7' " >
<div class="col-md-12" style="font-size: 1.0em; color: #a52a2a; font-weight: bold;">
Το αποτέλεσμα της προαγωγής σας δεν έχει καταχωρισθεί στο πληροφοριακό σύστημα του σχολείου (myschool).
Παρακαλώ επικοινωνήστε με τον διευθυντή του σχολείου σας.<br><br>
</div>
</div>
</div>
......@@ -470,7 +482,7 @@ import { IAppState } from "../../store/store";
ενεργοποίηση Τροποποίησης Αίτησης όταν: δεν υπάρχει αποτέλεσμα κατανομής για αυτήν την αίτηση
ΚΑΙ επιτρέπεται η τροποποίηση αιτήσεων
-->
<div *ngIf = "(StudentDetails$.status == '3' || StudentDetails$.status == '4' || StudentDetails$.status == '5' || StudentDetails$.status == '0') && StudentDetails$.applicantsAppModifyDisabled == '0'" >
<div *ngIf = "(StudentDetails$.status == '3' || StudentDetails$.status == '4' || StudentDetails$.status == '0') && StudentDetails$.applicantsAppModifyDisabled == '0'" >
<button type="button" class="btn-primary btn-lg pull-left isclickable" style="width: 10em;" (click)="editEpalApplication()">
<span style="font-size: 0.9em; font-weight: bold;">Επεξεργασία&nbsp;&nbsp;&nbsp;</span>
</button>
......
......@@ -88,6 +88,7 @@ export const VALID_DATE_PATTERN = "([1-9]|0[1-9]|[12][0-9]|3[01])[- /.]([1-9]|0[
export const SCHOOL_ROLE = "director";
export const SCHOOLGEL_ROLE = "director_gel";
export const SCHOOLGYMLT_ROLE = "director_gymlt";
export const SCHOOLGYM_ROLE = "director_gym";
export const STUDENT_ROLE = "student";
export const PDE_ROLE = "pde";
......
......@@ -2,7 +2,7 @@ import { Injectable } from "@angular/core";
import { CanActivate } from "@angular/router";
import { Router } from "@angular/router";
import { SCHOOLGEL_ROLE } from "../constants";
import { SCHOOLGEL_ROLE ,SCHOOLGYMLT_ROLE} from "../constants";
import { AuthService } from "../services/auth.service";
@Injectable()
......@@ -11,7 +11,7 @@ export default class SchoolGelStudentsLockedGuard implements CanActivate {
constructor(private authService: AuthService, private router: Router) { }
canActivate() {
return this.authService.isGelStudentsLocked(SCHOOLGEL_ROLE).then(isLocked => {
return this.authService.isGelStudentsLockedforTworoles(SCHOOLGEL_ROLE,SCHOOLGYMLT_ROLE).then(isLocked => {
if (isLocked) {
this.router.navigate(["/school"]);
return false;
......
......@@ -2,7 +2,7 @@ import { Injectable } from "@angular/core";
import { CanActivate } from "@angular/router";
import { Router } from "@angular/router";
import { SCHOOLGYM_ROLE } from "../constants";
import { SCHOOLGYM_ROLE,SCHOOLGYMLT_ROLE } from "../constants";
import { AuthService } from "../services/auth.service";
@Injectable()
......@@ -11,7 +11,7 @@ export default class SchoolGymStudentsLockedGuard implements CanActivate {
constructor(private authService: AuthService, private router: Router) { }
canActivate() {
return this.authService.isGelStudentsLocked(SCHOOLGYM_ROLE).then(isLocked => {
return this.authService.isGelStudentsLockedforTworoles(SCHOOLGYM_ROLE,SCHOOLGYMLT_ROLE).then(isLocked => {
if (isLocked) {
this.router.navigate(["/school"]);
return false;
......
......@@ -2,7 +2,7 @@ import { Injectable } from "@angular/core";
import { CanActivate } from "@angular/router";
import { Router } from "@angular/router";
import { SCHOOLGEL_ROLE } from "../constants";
import { SCHOOLGEL_ROLE ,SCHOOLGYMLT_ROLE} from "../constants";
import { AuthService } from "../services/auth.service";
@Injectable()
......@@ -11,7 +11,7 @@ export default class SchoolGelAuthGuard implements CanActivate {
constructor(private authService: AuthService, private router: Router) { }
canActivate() {
return this.authService.isLoggedIn(SCHOOLGEL_ROLE).then(loggedIn => {
return this.authService.isLoggedInFortworoles(SCHOOLGEL_ROLE,SCHOOLGYMLT_ROLE).then(loggedIn => {
if (!loggedIn) {
this.router.navigate(["/school/logout"]);
}
......
......@@ -2,7 +2,7 @@ import { Injectable } from "@angular/core";
import { CanActivate } from "@angular/router";
import { Router } from "@angular/router";
import { SCHOOLGYM_ROLE } from "../constants";
import { SCHOOLGYM_ROLE, SCHOOLGYMLT_ROLE } from "../constants";
import { AuthService } from "../services/auth.service";
@Injectable()
......@@ -11,7 +11,7 @@ export default class SchoolGymAuthGuard implements CanActivate {
constructor(private authService: AuthService, private router: Router) { }
canActivate() {
return this.authService.isLoggedIn(SCHOOLGYM_ROLE).then(loggedIn => {
return this.authService.isLoggedInFortworoles(SCHOOLGYM_ROLE, SCHOOLGYMLT_ROLE).then(loggedIn => {
if (!loggedIn) {
this.router.navigate(["/school/logout"]);
}
......
......@@ -20,7 +20,7 @@ export class AuthService {
.subscribe(linfo => {
if (linfo.size > 0) {
linfo.reduce(({}, loginInfoObj) => {
linfo.reduce(({}, loginInfoObj) => {
if ((loginInfoObj.auth_token && loginInfoObj.auth_token.length > 0 && loginInfoObj.auth_role === role) ||
(loginInfoObj.minedu_username && loginInfoObj.minedu_username.length > 0 && loginInfoObj.auth_role === MINISTRY_ROLE && role === MINISTRY_ROLE)
) {
......@@ -28,6 +28,7 @@ export class AuthService {
}
else {
resolve(false);
}
return loginInfoObj;
}, {});
......@@ -41,6 +42,34 @@ export class AuthService {
});
}
isLoggedInFortworoles(role1, role2) {
return new Promise<boolean>((resolve, reject) => {
this._ngRedux.select("loginInfo")
.map(loginInfo => <ILoginInfoRecords>loginInfo)
.subscribe(loginInfo => {
if (loginInfo.size > 0) {
loginInfo.reduce(({}, loginInfoObj) => {
if ((loginInfoObj.auth_token && loginInfoObj.auth_token.length > 0 && (loginInfoObj.auth_role === role1 || loginInfoObj.auth_role === role2)) ||
(loginInfoObj.minedu_username && loginInfoObj.minedu_username.length > 0 && loginInfoObj.auth_role === MINISTRY_ROLE )
) {
resolve(true);
}
else {
resolve(false);
}
return loginInfoObj;
}, {});
} else
resolve(false);
},
error => {
console.log("Error Getting Auth Data");
reject("Error Getting Auth Data");
});
});
}
isLoggedInForReports(role1, role2, role3) {
return new Promise<boolean>((resolve, reject) => {
this._ngRedux.select("loginInfo")
......@@ -200,6 +229,34 @@ export class AuthService {
});
}
isGelStudentsLockedforTworoles(role1,role2) {
return new Promise<boolean>((resolve, reject) => {
this._ngRedux.select("loginInfo")
.map(loginInfo => <ILoginInfoRecords>loginInfo)
.subscribe(loginInfo => {
if (loginInfo.size > 0) {
loginInfo.reduce(({}, loginInfoObj) => {
if ((loginInfoObj.lock_students_gel && loginInfoObj.lock_students_gel === 1 && (loginInfoObj.auth_role === role1 || loginInfoObj.auth_role === role2)))
{
resolve(true);
}
else {
resolve(false);
}
return loginInfoObj;
}, {});
} else
resolve(false);
},
error => {
console.log("Error Getting Auth Data");
reject("Error Getting Auth Data");
});
});
}
isCapacityLocked(role) {
return new Promise<boolean>((resolve, reject) => {
this._ngRedux.select("loginInfo")
......
......@@ -7,7 +7,7 @@ import { CookieService } from "ngx-cookie";
import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { AppSettings } from "../app.settings";
import { DIDE_ROLE, MINISTRY_ROLE, PDE_ROLE, SCHOOL_ROLE, SCHOOLGEL_ROLE, SCHOOLGYM_ROLE } from "../constants";
import { DIDE_ROLE, MINISTRY_ROLE, PDE_ROLE, SCHOOL_ROLE, SCHOOLGEL_ROLE, SCHOOLGYM_ROLE ,SCHOOLGYMLT_ROLE } from "../constants";
import { LOGININFO_INITIAL_STATE } from "../store/logininfo/logininfo.initial-state";
import { ILoginInfoRecords } from "../store/logininfo/logininfo.types";
import { IRRegionSchool } from "../store/regionschools/regionschools.types";
......@@ -428,7 +428,7 @@ export class HelperDataService implements OnInit, OnDestroy {
} else {
this.createAuthorizationHeader(headers);
}
if (this.authRole === SCHOOL_ROLE || this.authRole === SCHOOLGEL_ROLE || this.authRole === PDE_ROLE || this.authRole === DIDE_ROLE || this.authRole === SCHOOLGYM_ROLE) {
if (this.authRole === SCHOOL_ROLE || this.authRole === SCHOOLGEL_ROLE || this.authRole === PDE_ROLE || this.authRole === DIDE_ROLE || this.authRole === SCHOOLGYM_ROLE || this.authRole === SCHOOLGYMLT_ROLE) {
logoutRoute = "/cas/logout";
} else if (this.authRole === MINISTRY_ROLE) {
logoutRoute = "/ministry/logout";
......