Skip to content

Commit

Permalink
ILIAS REST-Plugin v.0.9
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
disc5 committed Jul 13, 2015
1 parent 7951235 commit 2363588
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* ILIAS REST Plugin for the ILIAS LMS
*
* Authors: D.Schaefer, S.Schneider and T. Hufschmidt <(schaefer|schneider|hufschmidt)@hrz.uni-marburg.de>
* 2014-2015
* Authors: D.Schaefer, T.Hufschmidt <(schaefer|hufschmidt)@hrz.uni-marburg.de>
* Since 2014
*/
namespace RESTController\core\auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* ILIAS REST Plugin for the ILIAS LMS
*
* Authors: D.Schaefer, S.Schneider and T. Hufschmidt <(schaefer|schneider|hufschmidt)@hrz.uni-marburg.de>
* 2014-2015
* Authors: D.Schaefer, T.Hufschmidt <(schaefer|hufschmidt)@hrz.uni-marburg.de>
* Since 2014
*/
namespace RESTController\core\auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* ILIAS REST Plugin for the ILIAS LMS
*
* Authors: D.Schaefer, S.Schneider and T. Hufschmidt <(schaefer|schneider|hufschmidt)@hrz.uni-marburg.de>
* 2014-2015
* Authors: D.Schaefer and T. Hufschmidt <(schaefer|hufschmidt)@hrz.uni-marburg.de>
* Since 2014
*/
namespace RESTController\core\auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* ILIAS REST Plugin for the ILIAS LMS
*
* Authors: D.Schaefer, S.Schneider and T. Hufschmidt <(schaefer|schneider|hufschmidt)@hrz.uni-marburg.de>
* 2014-2015
* Authors: D.Schaefer and T. Hufschmidt <(schaefer|hufschmidt)@hrz.uni-marburg.de>
* Since 2014
*/
namespace RESTController\core\auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@
<script type="text/javascript" src="libs/js/modernizr.js"></script>
<script>
<?php
// Fetch POST data
// Fetch POST data userName
$userName = isset($_POST['userName']) ? $_POST['userName'] : '';
$apiKey = isset($_POST['apiKey']) ? $_POST['apiKey'] : '';
$userId = isset($_POST['userId']) ? $_POST['userId'] : '';
$sessionId = isset($_POST['sessionId']) ? $_POST['sessionId'] : '';
$rtoken = isset($_POST['rtoken']) ? $_POST['rtoken'] : '';
$restEndpoint = isset($_POST['restEndpoint']) ? $_POST['restEndpoint'] : '';

// Make it save
$userName = addslashes (htmlspecialchars($userName, ENT_COMPAT | ENT_HTML5));
$apiKey = addslashes (htmlspecialchars($apiKey, ENT_COMPAT | ENT_HTML5));
$userId = addslashes (htmlspecialchars($userId, ENT_COMPAT | ENT_HTML5));
$sessionId = addslashes (htmlspecialchars($sessionId, ENT_COMPAT | ENT_HTML5));
Expand All @@ -45,6 +47,7 @@

var postVars = {
userId: "<?php echo $userId; ?>",
userName: "<?php echo $userName; ?>",
sessionId: "<?php echo $sessionId; ?>",
rtoken: "<?php echo $rtoken; ?>",
restEndpoint: "<?php echo $restEndpoint; ?>",
Expand Down Expand Up @@ -76,7 +79,6 @@

<ul class="nav navbar-nav navbar-right addRightPadding" data-ng-show="authentication.isAuthenticated()" data-ng-cloak>
<li><button class="btn btn-default navbar-btn" type="button" data-ng-click="reload()"><span class="glyphicon glyphicon-repeat"></span></button></li>
<!-- end-=time"10000" 1451628000000 -->
<li><span class="navbar-text">{{'INDEX_LOGGED_IN' | translate:translationData}} [<timer countdown="1800" max-time-unit="'minute'" interval="1000" finish-callback="authentication.logout()">{{mminutes}}:{{sseconds}}</timer>]</span></li>
<li><button class="btn btn-default navbar-btn" type="button" data-ng-click="authentication.logout()">{{'INDEX_LOGOUT' | translate}}</button></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var app = angular.module('myApp', [
/*
* Some (important) global constants, all in one place
*/
app.constant('version', '1.0'); // Application version
app.constant('version', '1.1'); // Application version
app.constant('apiKey', 'apollon'); // API-Key used to log into admin-panel (via username/password)
app.constant('restIliasLoginURL', '/v1/ilauth/rtoken2bearer'); // rToken to Bearer-Token Endpoint
app.constant('restTokenURL', '/v1/oauth2/token'); // Bearer-Token from Username, Password, API-Key pair Endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,16 @@ ctrl.controller('LoginCtrl', function($scope, $location, $filter, apiKey, restAu
api_key: $scope.postVars.apiKey,
user_id: $scope.postVars.userId,
session_id: $scope.postVars.sessionId,
rtoken: $scope.postVars.rtoken
rtoken: $scope.postVars.rtoken,
userName: $scope.postVars.userName,
},
// Success
function (response) {
// Login return OK (Login internally and redirect)
if (response.status == "success") {
//console.log(JSON.stringify(response));
$scope.authentication.login($scope.postVars.userName, response.access_token);
$scope.postVars = {};
$scope.authentication.login(response.user, response.access_token);
$location.url("/clientlist");
$scope.$emit('loginPerformed');
// Login didn't return an OK (Logout internally and redirdct)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* ILIAS REST Plugin for the ILIAS LMS
*
* Authors: D.Schaefer, S.Schneider and T. Hufschmidt <(schaefer|schneider|hufschmidt)@hrz.uni-marburg.de>
* 2014-2015
* Authors: D.Schaefer, T.Hufschmidt <(schaefer|hufschmidt)@hrz.uni-marburg.de>
* Since 2014
*/


Expand Down Expand Up @@ -68,6 +68,7 @@ function configure() {
$configHTML .= '
<form action="' . $pl->getDirectory() . '/apps/admin/index.php" method="post" target="_blank" id="redirectForm">
<input type="hidden" name="userId" value="'.$ilUser->getId().'" />
<input type="hidden" name="userName" value="'.$ilUser->getLogin().'" />
<input type="hidden" name="sessionId" value="'.session_id().'" />
<input type="hidden" name="rtoken" value="'.$ilCtrl->rtoken.'" />
<input type="hidden" name="restEndpoint" value="'.$inst_folder.'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* ILIAS REST Plugin for the ILIAS LMS
*
* Authors: D.Schaefer, S.Schneider and T. Hufschmidt <(schaefer|schneider|hufschmidt)@hrz.uni-marburg.de>
* 2014-2015
* Authors: D.Schaefer, T.Hufschmidt <(schaefer|hufschmidt)@hrz.uni-marburg.de>
* Since 2014
*/


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* ILIAS REST Plugin for the ILIAS LMS
*
* Authors: D.Schaefer, S.Schneider and T. Hufschmidt <(schaefer|schneider|hufschmidt)@hrz.uni-marburg.de>
* 2014-2015
* Authors: D.Schaefer, T.Hufschmidt <(schaefer|hufschmidt)@hrz.uni-marburg.de>
* Since 2014
*/


Expand Down

0 comments on commit 2363588

Please sign in to comment.