Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Χάρης Παπαδόπουλος
e-epal
Commits
9fbeb5be
Commit
9fbeb5be
authored
Jun 14, 2017
by
Χάρης Παπαδόπουλος
Browse files
merging to master. Conflicts Resolution
parents
638f8b21
159801c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
drupal/modules/casost/src/Controller/CASLogin.php
View file @
9fbeb5be
...
...
@@ -123,44 +123,6 @@ class CASLogin extends ControllerBase
}
$attributes
=
phpCAS
::
getAttributes
();
/*
$isAllowed = true;
$att1 = $attributes[$this->allowed1];
$att2 = $attributes[$this->allowed2];
if (!isset($att1) || !isset($att2)) {
$isAllowed = false;
}
if (!is_array($attributes[$this->allowed1])) {
$attributes[$this->allowed1] = [$attributes[$this->allowed1]];
}
if (!is_array($attributes[$this->allowed2])) {
$attributes[$this->allowed2] = [$attributes[$this->allowed2]];
}
$found1 = false;
foreach ($attributes[$this->allowed1] as $value) {
if (1 === preg_match($this->allowed1Value, $value)) {
$found1 = true;
}
}
$found2 = false;
foreach ($attributes[$this->allowed2] as $value) {
if (1 === preg_match($this->allowed2Value, $value)) {
$found2 = true;
}
}
if (!$found1 || !$found2) {
$isAllowed = false;
}
if (!$isAllowed) {
$response = new Response();
$response->setContent(t('Access is allowed only to official school accounts'));
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json;charset=UTF-8');
return $response;
}
*/
$CASUser
=
phpCAS
::
getUser
();
$this
->
logger
->
warning
(
$CASUser
);
...
...
@@ -173,28 +135,12 @@ class CASLogin extends ControllerBase
};
$umdobject
=
$filterAttribute
(
"umdobject"
);
// $physicaldeliveryofficename = $filterAttribute("physicaldeliveryofficename");
/****** the following is for production : Χρήση μόνο από ΕΠΙΣΗΜΟΥΣ ΛΟΓΑΡΙΑΣΜΟΥΣ ***************************/
/*
if (!$umdobject || $umdobject !== "Account") {
return $this->redirectForbidden($configRowName, '5002');
}
if (!$physicaldeliveryofficename || preg_replace('/\s+/', '', $physicaldeliveryofficename) !== 'ΕΠΙΣΗΜΟΣΛΟΓΑΡΙΑΣΜΟΣ') {
return $this->redirectForbidden($configRowName, '5003');
}
*/
phpCAS
::
trace
(
$umdobject
);
// phpCAS::trace($physicaldeliveryofficename);
// $gsnunitcodedn = $filterAttribute('edupersonorgunitdn:gsnunitcode:extended');
$gsnunitcode
=
substr
(
$gsnunitcodedn
,
strpos
(
$gsnunitcodedn
,
";"
)
+
1
);
$gsnunitcode
=
$filterAttribute
(
'edupersonorgunitdn:gsnunitcode'
);
phpCAS
::
trace
(
"
$gsnunitcode
="
);
phpCAS
::
trace
(
$gsnunitcode
);
/* check if myschool account */
if
(
!
$umdobject
||
$umdobject
!==
"ISaccount"
)
{
return
$this
->
redirectForbidden
(
$configRowName
,
'5002'
);
...
...
@@ -204,11 +150,8 @@ class CASLogin extends ControllerBase
}
/* end of checking myschool account */
$userAssigned
=
$this
->
assignRoleToUser
(
$gsnunitcode
);
if
(
sizeof
(
$userAssigned
)
===
0
)
{
return
$this
->
redirectForbidden
(
$configRowName
,
'5004'
);
}
...
...
drupal/modules/casost/src/Controller/CASLogout.php
View file @
9fbeb5be
...
...
@@ -44,7 +44,7 @@ class CASLogout extends ControllerBase
Connection
$connection
,
LoggerChannelFactoryInterface
$loggerChannel
)
{
$this
->
entityTypeManager
=
$entityTypeManager
;
$this
->
entity_query
=
$entity_query
;
$this
->
connection
=
$connection
;
...
...
@@ -117,10 +117,6 @@ 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
JsonResponse
([
"message"
=>
"Server logout successful"
,
...
...
@@ -130,9 +126,6 @@ class CASLogout extends ControllerBase
session_unset
();
session_destroy
();
\
Drupal
::
service
(
'page_cache_kill_switch'
)
->
trigger
();
// phpCAS::logout(array('service' => 'http://eduslim2.minedu.gov.gr/dist/#/school'));
// phpCAS::logoutWithRedirectService('http://eduslim2.minedu.gov.gr/dist/#/school');
// phpCAS::handleLogoutRequests();
session_start
();
return
$response
;
...
...
@@ -176,6 +169,7 @@ class CASLogout extends ControllerBase
$response
=
new
Response
();
$response
->
setContent
(
"{\"
message
\
":
\"
Server logout continue
\"
,
\"
next
\"
:
\"
{
$this
->
logoutRedirectUrl
}
\"
}"
);
$response
->
setStatusCode
(
Response
::
HTTP_OK
);
$response
->
headers
->
set
(
'Content-Type'
,
'application/json'
);
...
...
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