Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
6252fe24
Commit
6252fe24
authored
Apr 20, 2017
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'component_updates' into 'develop'
Component updates See merge request !55
parents
543cf19e
e00c4b62
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
424 additions
and
12 deletions
+424
-12
drupal/modules/epal/epal.routing.yml
drupal/modules/epal/epal.routing.yml
+10
-3
drupal/modules/epal/src/Controller/MinistryLogin.php
drupal/modules/epal/src/Controller/MinistryLogin.php
+122
-0
drupal/modules/epaldeploysystem/config/optional/user.role.ministry.yml
...s/epaldeploysystem/config/optional/user.role.ministry.yml
+45
-0
source/actions/logininfo.actions.ts
source/actions/logininfo.actions.ts
+11
-1
source/app.settings.deployment.ts
source/app.settings.deployment.ts
+1
-1
source/app.settings.ts
source/app.settings.ts
+2
-2
source/components/minister/minister-view.ts
source/components/minister/minister-view.ts
+71
-0
source/components/ministry.home.ts
source/components/ministry.home.ts
+111
-0
source/components/school.home.ts
source/components/school.home.ts
+7
-0
source/containers/main.routes.ts
source/containers/main.routes.ts
+7
-1
source/services/helper-data-service.ts
source/services/helper-data-service.ts
+31
-2
source/store/logininfo/logininfo.reducer.ts
source/store/logininfo/logininfo.reducer.ts
+2
-1
source/store/logininfo/logininfo.transformers.ts
source/store/logininfo/logininfo.transformers.ts
+2
-1
source/store/logininfo/logininfo.types.ts
source/store/logininfo/logininfo.types.ts
+2
-0
No files found.
drupal/modules/epal/epal.routing.yml
View file @
6252fe24
...
...
@@ -105,7 +105,7 @@ confirmstudents:
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::ConfirmStudents'
requirements
:
_user_is_logged_in
:
'
TRUE'
_user_is_logged_in
:
'
TRUE'
studentperschool
:
path
:
'
/epal/studentperSchool/{epalId}/{selectId}/{classId}'
options
:
...
...
@@ -121,5 +121,12 @@ savecapacity:
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::SaveCapacity'
requirements
:
_user_is_logged_in
:
'
TRUE'
_user_is_logged_in
:
'
TRUE'
epal.ministry.log_in_go
:
path
:
'
/ministry/login'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\MinistryLogin::loginGo'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/epal/src/Controller/MinistryLogin.php
0 → 100644
View file @
6252fe24
<?php
namespace
Drupal\epal\Controller
;
use
Drupal\Core\Entity\Query\QueryFactory
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\user\Entity\User
;
//use Drupal\Core\Database\Connection;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Drupal\Core\Logger\LoggerChannelFactoryInterface
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Symfony\Component\HttpFoundation\RedirectResponse
;
class
MinistryLogin
extends
ControllerBase
{
//protected $entity_query;
protected
$entityTypeManager
;
protected
$logger
;
//protected $connection;
public
function
__construct
(
EntityTypeManagerInterface
$entityTypeManager
,
//QueryFactory $entity_query,
// $connection,
LoggerChannelFactoryInterface
$loggerChannel
)
{
$this
->
entityTypeManager
=
$entityTypeManager
;
//$this->entity_query = $entity_query;
//$this->connection = $connection;
$this
->
logger
=
$loggerChannel
->
get
(
'epal'
);
}
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'entity.manager'
),
//$container->get('entity.query'),
//$container->get('database'),
$container
->
get
(
'logger.factory'
)
);
}
public
function
loginGo
(
Request
$request
)
{
if
(
!
$request
->
isMethod
(
'POST'
))
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Method Not Allowed"
)
],
Response
::
HTTP_METHOD_NOT_ALLOWED
);
}
try
{
//user validation
//Note: $authToken = $postData->username
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
!
$user
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//user role validation
//$user = \Drupal\user\Entity\User::load($user->id());
$roles
=
$user
->
getRoles
();
$validRole
=
false
;
foreach
(
$roles
as
$role
)
if
(
$role
===
"ministry"
)
{
$validRole
=
true
;
break
;
}
if
(
!
$validRole
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User Invalid Role"
),
],
Response
::
HTTP_FORBIDDEN
);
}
$currentRoleName
=
"supervisor"
;
$postData
=
null
;
if
(
$content
=
$request
->
getContent
())
{
$postData
=
json_decode
(
$content
);
//return new RedirectResponse("/drupal-8.2.6/eepal/dist/" . '?auth_token=' . $postData->username .'&auth_role=supervisor', 302, []);
return
$this
->
respondWithStatus
([
'auth_token'
=>
$postData
->
username
,
'userpassword'
=>
$postData
->
userpassword
,
'auth_role'
=>
$currentRoleName
,
],
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"post with no data"
),
],
Response
::
HTTP_BAD_REQUEST
);
}
}
//end try
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
$response
=
new
Response
();
$response
->
setContent
(
'forbidden'
);
$response
->
setStatusCode
(
Response
::
HTTP_FORBIDDEN
);
$response
->
headers
->
set
(
'Content-Type'
,
'application/json'
);
return
$response
;
}
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
return
$res
;
}
}
drupal/modules/epaldeploysystem/config/optional/user.role.ministry.yml
0 → 100644
View file @
6252fe24
langcode
:
el
status
:
true
dependencies
:
{
}
id
:
ministry
label
:
ministry
weight
:
4
is_admin
:
null
permissions
:
-
'
add
epal
student
course
field
entities'
-
'
add
epal
student
epal
chosen
entities'
-
'
add
epal
student
sector
field
entities'
-
'
add
epal
users
entities'
-
'
delete
epal
student
course
field
entities'
-
'
delete
epal
student
epal
chosen
entities'
-
'
delete
epal
student
sector
field
entities'
-
'
delete
epal
users
entities'
-
'
edit
epal
class
limits
entities'
-
'
edit
epal
student
course
field
entities'
-
'
edit
epal
student
epal
chosen
entities'
-
'
edit
epal
student
sector
field
entities'
-
'
edit
epal
users
entities'
-
'
view
published
epal
student
course
field
entities'
-
'
view
published
epal
student
epal
chosen
entities'
-
'
view
published
epal
student
sector
field
entities'
-
'
view
published
epal
users
entities'
-
'
view
unpublished
epal
student
course
field
entities'
-
'
view
unpublished
epal
student
epal
chosen
entities'
-
'
view
unpublished
epal
student
sector
field
entities'
-
'
view
unpublished
epal
users
entities'
-
'
view
published
eepal
admin
area
entities'
-
'
view
published
eepal
prefecture
entities'
-
'
view
published
eepal
region
entities'
-
'
view
published
eepal
school
entities'
-
'
view
published
eepal
sectors
entities'
-
'
view
published
eepal
sectors
in
epal
entities'
-
'
view
published
eepal
specialties
in
epal
entities'
-
'
view
published
eepal
specialty
entities'
-
'
view
unpublished
eepal
admin
area
entities'
-
'
view
unpublished
eepal
prefecture
entities'
-
'
view
unpublished
eepal
region
entities'
-
'
view
unpublished
eepal
school
entities'
-
'
view
unpublished
eepal
sectors
entities'
-
'
view
unpublished
eepal
sectors
in
epal
entities'
-
'
view
unpublished
eepal
specialties
in
epal
entities'
-
'
view
unpublished
eepal
specialty
entities'
source/actions/logininfo.actions.ts
View file @
6252fe24
...
...
@@ -11,7 +11,7 @@ export class LoginInfoActions {
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
_hds
:
HelperDataService
)
{}
getloginInfo
=
(
loginInfo
)
=>
{
return
this
.
_hds
.
getCurrentUser
(
loginInfo
.
auth_token
,
loginInfo
.
auth_role
).
then
(
loginInfos
=>
{
return
this
.
_ngRedux
.
dispatch
({
...
...
@@ -23,6 +23,16 @@ export class LoginInfoActions {
});
}
saveMinEduloginInfo
=
(
loginInfos
)
=>
{
return
this
.
_ngRedux
.
dispatch
({
type
:
LOGININFO_SAVE
,
payload
:
{
loginInfos
}
});
};
initLoginInfo
=
()
=>
{
return
this
.
_ngRedux
.
dispatch
({
type
:
LOGININFO_INIT
,
...
...
source/app.settings.deployment.ts
View file @
6252fe24
...
...
@@ -2,6 +2,6 @@ export const API_ENDPOINT = 'http://localhost/drupal-8.2.6';
export
class
AppSettings
{
public
static
get
API_ENDPOINT
():
string
{
return
'
http://localhost/drupal-8.2.
5
'
;
return
'
http://localhost/drupal-8.2.
6
'
;
}
}
source/app.settings.ts
View file @
6252fe24
// export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/drupal';
export
const
API_ENDPOINT
=
'
http://eduslim2.minedu.gov.gr/drupal
'
;
export
const
API_ENDPOINT
=
'
http://eduslim2.minedu.gov.gr/drupal
-8.2.6
'
;
export
class
AppSettings
{
public
static
get
API_ENDPOINT
():
string
{
// return 'http://eduslim2.minedu.gov.gr/drupal';
return
'
http://eduslim2.minedu.gov.gr/drupal
'
;
return
'
http://eduslim2.minedu.gov.gr/drupal
-8.2.6
'
;
}
}
source/components/minister/minister-view.ts
0 → 100644
View file @
6252fe24
import
{
Component
,
OnInit
,
OnDestroy
,
ElementRef
,
ViewChild
}
from
"
@angular/core
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
AppSettings
}
from
'
../../app.settings
'
;
import
{
HelperDataService
}
from
'
../../services/helper-data-service
'
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Http
,
Headers
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
IAppState
}
from
'
../../store/store
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
ILoginInfo
}
from
'
../../store/logininfo/logininfo.types
'
;
import
{
FormBuilder
,
FormGroup
,
FormControl
,
FormArray
,
Validators
,
}
from
'
@angular/forms
'
;
import
{
API_ENDPOINT
}
from
'
../../app.settings
'
;
@
Component
({
selector
:
'
minister-view
'
,
template
:
`
<div>
<form [formGroup]="formGroup" method = "POST" action="{{apiEndPoint}}/epal/distribution" #form>
<button type="submit" class="btn-primary btn-md" (click)="form.submit()" [disabled]="true">
Εκτέλεση Κατανομής Μαθητών
</button>
</form>
</div>
`
})
@
Injectable
()
export
default
class
MinisterView
implements
OnInit
,
OnDestroy
{
public
formGroup
:
FormGroup
;
private
apiEndPoint
=
API_ENDPOINT
;
constructor
(
private
fb
:
FormBuilder
,
private
_hds
:
HelperDataService
,
private
activatedRoute
:
ActivatedRoute
,
private
router
:
Router
)
{
this
.
formGroup
=
this
.
fb
.
group
({
});
}
ngOnDestroy
()
{
}
ngOnInit
()
{
}
runDistribution
()
{
}
}
source/components/ministry.home.ts
0 → 100644
View file @
6252fe24
import
{
Router
,
Params
}
from
'
@angular/router
'
;
import
{
OnInit
,
Component
}
from
'
@angular/core
'
;
import
{
LoginInfoActions
}
from
'
../actions/logininfo.actions
'
;
import
{
ILoginInfo
}
from
'
../store/logininfo/logininfo.types
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
Observable
}
from
'
rxjs/Rx
'
;
import
{
IAppState
}
from
'
../store/store
'
;
import
{
HelperDataService
}
from
'
../services/helper-data-service
'
;
import
{
Http
,
Response
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
FormBuilder
,
FormGroup
,
FormControl
,
FormArray
,
Validators
}
from
'
@angular/forms
'
;
import
{
API_ENDPOINT
}
from
'
../app.settings
'
;
@
Component
({
selector
:
'
ministry-home
'
,
template
:
`
<div>
<form novalidate [formGroup]="userDataGroup" #form>
<div class="form-group">
<label for="minedu_username">Όνομα διαχειριστή</label><input class="form-control" type="text" formControlName="minedu_username">
</div>
<div class="alert alert-danger" *ngIf="userDataGroup.get('minedu_username').touched && userDataGroup.get('minedu_username').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="form-group">
<label for="minedu_userpassword">Κωδικός πρόσβασης</label><input class="form-control" type="password" formControlName="minedu_userpassword">
</div>
<div class="alert alert-danger" *ngIf="userDataGroup.get('minedu_userpassword').touched && userDataGroup.get('minedu_userpassword').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>
<div class="row" style="min-height: 300px; margin-top: 100px;">
<div *ngIf="!mineduUsername" class="col-md-8 offset-md-4">
<button type="submit" class="btn-primary btn-lg" (click)="submitCredentials()" [disabled]="userDataGroup.invalid">
Είσοδος<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
</form>
</div>
`
})
export
default
class
MinistryHome
implements
OnInit
{
public
userDataGroup
:
FormGroup
;
private
authRole
:
string
;
private
mineduUsername
:
string
;
private
mineduPassword
:
string
;
private
loginInfo$
:
Observable
<
ILoginInfo
>
;
private
apiEndPoint
=
API_ENDPOINT
;
constructor
(
private
fb
:
FormBuilder
,
private
_ata
:
LoginInfoActions
,
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
_hds
:
HelperDataService
,
private
http
:
Http
,
private
router
:
Router
)
{
this
.
mineduUsername
=
''
;
this
.
mineduPassword
=
''
;
this
.
authRole
=
''
;
this
.
userDataGroup
=
this
.
fb
.
group
({
minedu_username
:
[
'
minedu01
'
,
[
Validators
.
required
]],
minedu_userpassword
:
[
'
12345678
'
,
[
Validators
.
required
]],
});
};
ngOnInit
()
{
this
.
loginInfo$
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
mineduUsername
=
loginInfoToken
.
minedu_username
;
this
.
mineduPassword
=
loginInfoToken
.
minedu_userpassword
;
if
(
this
.
mineduUsername
&&
this
.
mineduUsername
.
length
>
0
)
this
.
router
.
navigate
([
'
/ministry/minister-view
'
]);
return
loginInfoToken
;
},
{});
}
return
state
.
loginInfo
;
});
}
submitCredentials
()
{
let
success
=
true
;
this
.
_hds
.
sendMinisrtyCredentials
(
this
.
userDataGroup
.
value
[
'
minedu_username
'
],
this
.
userDataGroup
.
value
[
'
minedu_userpassword
'
])
.
catch
(
err
=>
{
console
.
log
(
err
);
success
=
false
;})
.
then
(
msg
=>
{
if
(
success
)
{
this
.
authRole
=
'
supervisor
'
;
console
.
log
(
"
MPHKA
"
);
this
.
_ata
.
saveMinEduloginInfo
([
this
.
userDataGroup
.
value
]);
}
});
}
}
source/components/school.home.ts
View file @
6252fe24
...
...
@@ -76,8 +76,15 @@ export default class SchoolHome implements OnInit {
// subscribe to router event
this
.
activatedRoute
.
queryParams
.
subscribe
((
params
:
Params
)
=>
{
if
(
params
)
{
this
.
authToken
=
params
[
'
auth_token
'
];
console
.
log
(
"
NIKOS1
"
);
console
.
log
(
this
.
authToken
);
this
.
authRole
=
params
[
'
auth_role
'
];
console
.
log
(
"
NIKOS2
"
);
console
.
log
(
this
.
authRole
);
}
if
(
this
.
authToken
&&
this
.
authRole
)
...
...
source/containers/main.routes.ts
View file @
6252fe24
...
...
@@ -10,6 +10,7 @@ import StudentApplicationMain from '../components/student-application-form/appli
import
StudentsList
from
'
../components/students/students-list
'
;
import
Home
from
'
../components/home
'
;
import
SchoolHome
from
'
../components/school.home
'
;
import
MinistryHome
from
'
../components/ministry.home
'
;
import
CourseFieldsSelect
from
'
../components/student-application-form/course.fields.select
'
;
import
EpalClassesSelect
from
'
../components/student-application-form/epal.class.select
'
;
import
SectorFieldsSelect
from
'
../components/student-application-form/sector.fields.select
'
;
...
...
@@ -22,12 +23,14 @@ import SubmitedPreview from '../components/student-application-form/submited.apl
import
SubmitedPerson
from
'
../components/student-application-form/submitedstudent.preview
'
;
import
DirectorView
from
'
../components/director/director-view
'
;
import
DirectorClassCapacity
from
'
../components/director/director-classcapacity
'
;
import
MinisterView
from
'
../components/minister/minister-view
'
;
import
SchoolAuthGuard
from
'
../guards/school.auth.guard
'
;
import
StudentAuthGuard
from
'
../guards/student.auth.guard
'
;
export
const
MainRoutes
:
Routes
=
[
{
path
:
''
,
component
:
Home
},
{
path
:
'
school
'
,
component
:
SchoolHome
},
{
path
:
'
ministry
'
,
component
:
MinistryHome
},
{
path
:
'
parent-form
'
,
component
:
ParentForm
,
canActivate
:
[
StudentAuthGuard
]
},
{
path
:
'
student-application-form-main
'
,
component
:
StudentApplicationMain
,
canActivate
:
[
StudentAuthGuard
]
},
// { path: 'students-list', component: StudentsList },
...
...
@@ -43,6 +46,7 @@ export const MainRoutes: Routes = [
{
path
:
'
submited-person
'
,
component
:
SubmitedPerson
,
canActivate
:
[
StudentAuthGuard
]
},
{
path
:
'
school/director-view
'
,
component
:
DirectorView
,
canActivate
:
[
SchoolAuthGuard
]
},
{
path
:
'
school/director-classcapacity
'
,
component
:
DirectorClassCapacity
,
canActivate
:
[
SchoolAuthGuard
]
},
{
path
:
'
ministry/minister-view
'
,
component
:
MinisterView
},
];
export
const
MainDeclarations
=
[
...
...
@@ -51,6 +55,7 @@ export const MainDeclarations = [
StudentsList
,
Home
,
SchoolHome
,
MinistryHome
,
CourseFieldsSelect
,
EpalClassesSelect
,
SectorFieldsSelect
,
...
...
@@ -64,5 +69,6 @@ export const MainDeclarations = [
SubmitedPreview
,
SubmitedPerson
,
DirectorView
,
DirectorClassCapacity
DirectorClassCapacity
,
MinisterView
];
source/services/helper-data-service.ts
View file @
6252fe24
...
...
@@ -46,17 +46,20 @@ export class HelperDataService implements OnInit, OnDestroy {
ngOnDestroy
()
{
this
.
loginInfo$
.
unsubscribe
();
}
createAuthorizationHeader
(
headers
:
Headers
)
{
headers
.
append
(
'
Authorization
'
,
'
Basic
'
+
btoa
(
this
.
authToken
+
'
:
'
+
this
.
authToken
));
}
createMinistryAuthorizationHeader
(
headers
:
Headers
,
username
:
string
,
passwd
:
string
)
{
headers
.
append
(
'
Authorization
'
,
'
Basic
'
+
btoa
(
username
+
'
:
'
+
passwd
));
}
getEpalUserData
()
{
this
.
loginInfo$
.
getValue
().
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
});
console
.
log
(
"
authToken=
"
+
this
.
authToken
);
console
.
log
(
"
authRole=
"
+
this
.
authRole
);
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
...
...
@@ -632,6 +635,32 @@ export class HelperDataService implements OnInit, OnDestroy {
}
sendMinisrtyCredentials
(
username
,
userpassword
)
{
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
//"Accept": "*/*",
//"Access-Control-Allow-Credentials": "true",
//"X-CSRF-Token": "..."
//"Authorization": "Basic " + btoa("..."),
});
this
.
createMinistryAuthorizationHeader
(
headers
,
username
,
userpassword
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
http
.
post
(
`
${
AppSettings
.
API_ENDPOINT
}
/ministry/login`
,
{
username
:
username
,
userpassword
:
userpassword
},
options
)
.
map
(
response
=>
response
.
json
())
.
subscribe
(
data
=>
{
resolve
(
data
);
},
error
=>
{
//console.log("Error Sending Ministry Credentials");
reject
(
"
Error Sending Ministry Credentials
"
);
},
()
=>
console
.
log
(
""
));
});
}
...
...
source/store/logininfo/logininfo.reducer.ts
View file @
6252fe24
...
...
@@ -13,7 +13,8 @@ export function loginInfoReducer(state: ILoginInfo = LOGININFO_INITIAL_STATE, ac
let
loginInfoTokens
=
Array
<
ILoginInfoToken
>
();
let
i
=
0
;
action
.
payload
.
loginInfos
.
forEach
(
loginInfo
=>
{
loginInfoTokens
.
push
(
<
ILoginInfoToken
>
{
auth_token
:
loginInfo
.
auth_token
,
auth_role
:
loginInfo
.
auth_role
,
cu_name
:
loginInfo
.
cu_name
});
loginInfoTokens
.
push
(
<
ILoginInfoToken
>
{
auth_token
:
loginInfo
.
auth_token
,
auth_role
:
loginInfo
.
auth_role
,
cu_name
:
loginInfo
.
cu_name
,
minedu_username
:
loginInfo
.
minedu_username
,
minedu_userpassword
:
loginInfo
.
minedu_userpassword
});
i
++
;
});
return
Seq
(
loginInfoTokens
).
map
(
n
=>
n
).
toList
();
...
...
source/store/logininfo/logininfo.transformers.ts
View file @
6252fe24
...
...
@@ -3,7 +3,8 @@ import { ILoginInfo, ILoginInfoToken } from './logininfo.types';
export
function
deimmutifyLoginInfo
(
state
:
ILoginInfo
):
ILoginInfoToken
[]
{
let
fetchedLoginInfoTokens
=
new
Array
();
state
.
forEach
(
loginInfoToken
=>
{
fetchedLoginInfoTokens
.
push
(
<
ILoginInfoToken
>
{
auth_token
:
loginInfoToken
.
auth_token
,
auth_role
:
loginInfoToken
.
auth_role
,
cu_name
:
loginInfoToken
.
cu_name
});
fetchedLoginInfoTokens
.
push
(
<
ILoginInfoToken
>
{
auth_token
:
loginInfoToken
.
auth_token
,
auth_role
:
loginInfoToken
.
auth_role
,
cu_name
:
loginInfoToken
.
cu_name
,
minedu_username
:
loginInfoToken
.
minedu_username
,
minedu_userpassword
:
loginInfoToken
.
minedu_userpassword
});
});
return
fetchedLoginInfoTokens
;
};
source/store/logininfo/logininfo.types.ts
View file @
6252fe24
...
...
@@ -4,6 +4,8 @@ export interface ILoginInfoToken {
auth_token
:
string
;
auth_role
:
string
;
cu_name
:
string
;
minedu_username
:
string
;
minedu_userpassword
:
string
;
}
export
type
ILoginInfo
=
List
<
ILoginInfoToken
>
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment