Compare commits

..
22 changed files with 238 additions and 619 deletions
+19 -43
View File
@@ -1,27 +1,11 @@
<?php
/**
* Copyright (C) 2025 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Header menu
$root = CIS_ROOT;
if (defined('CIS4') && CIS4) $root = APP_ROOT;
// --------------------------------------------------------------------------------------------------------------------
// Head menu
if(defined('CIS4') && CIS4) {
$root = APP_ROOT;
} else {
$root = CIS_ROOT;
}
$config['navigation_header'] = array(
'*' => array(
@@ -218,20 +202,13 @@ $config['navigation_header'] = array(
'sort' => 20,
'requiredPermissions' => 'system/developer:r'
),
'anrechnungen' => array(
'link' => site_url('lehre/anrechnung/AdminAnrechnung'),
'description' => 'Anrechnungen',
'expand' => true,
'sort' => 30,
'requiredPermissions' => 'lehre/anrechnungszeitfenster:rw'
),
'loginas' => array(
'link' => site_url('system/Login/loginAs'),
'description' => 'Login as',
'expand' => true,
'sort' => 40,
'requiredPermissions' => 'admin:rw'
),
'anrechnungen' => array(
'link' => site_url('lehre/anrechnung/AdminAnrechnung'),
'description' => 'Anrechnungen',
'expand' => true,
'sort' => 30,
'requiredPermissions' => 'lehre/anrechnungszeitfenster:rw'
),
'dashboardadmin' => array(
'link' => site_url('dashboard/Admin'),
'description' => 'Dashboard Admin',
@@ -259,12 +236,12 @@ $config['navigation_menu']['Vilesci/index'] = array(
);
$config['navigation_menu']['Vilesci/index'] = array(
'dashboard' => array(
'link' => '#',
'description' => 'Dashboard',
'icon' => 'dashboard',
'sort' => 1
)
'dashboard' => array(
'link' => '#',
'description' => 'Dashboard',
'icon' => 'dashboard',
'sort' => 1
)
);
$config['navigation_menu']['organisation/Reihungstest/index'] = array(
@@ -406,4 +383,3 @@ $config['navigation_menu']['apps'] = [
'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r', 'lehre/lehrauftrag_erteilen:r')
]
];
@@ -1,137 +0,0 @@
<?php
/**
* Copyright (C) 2025 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class Login extends FHCAPI_Controller
{
/**
* Object initialization
*/
public function __construct()
{
parent::__construct(array(
'loginLDAP' => self::PERM_ANONYMOUS,
'loginASByUid' => 'admin:rw',
'loginASByPersonId' => 'admin:rw',
'whoAmI' => self::PERM_ANONYMOUS,
'searchUser' => 'admin:rw'
));
}
/**
* Called with HTTP POST via ajax to login using the LDAP authentication
*/
public function loginLDAP()
{
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->library('AuthLib', array(false)); // without authentication otherwise loooooop!
$login = $this->authlib->loginLDAP($username, $password);
// If login is success then retrieves the desired page
if (isSuccess($login)) $this->terminateWithSuccess($this->authlib->getLandingPage());
$this->terminateWithError(getError($login)); // returns the error code
}
/**
* Called with HTTP POST via ajax to login as another user specified by uid
*/
public function loginASByUid()
{
$uid = $this->input->post('uid');
// With authentication -> you must be already logged to gain another identity
$this->load->library('AuthLib');
$loginAS = $this->authlib->loginASByUID($uid);
// Got it!
if (isSuccess($loginAS)) $this->terminateWithSuccess(true);
// Returns the error code
$this->terminateWithError(getError($loginAS));
}
/**
* Called with HTTP POST via ajax to login as another user specified by person id
*/
public function loginASByPersonId()
{
$person_id = $this->input->post('person_id');
// With authentication -> you must be already logged to gain another identity
$this->load->library('AuthLib');
$loginAS = $this->authlib->loginASByPersonId($person_id);
// Got it!
if (isSuccess($loginAS)) $this->terminateWithSuccess(true);
// Returns the error code
$this->terminateWithError(getError($loginAS));
}
/**
* Called with HTTP GET via ajax to show which login cretentials are in use
*/
public function whoAmI()
{
// With authentication -> you must be already logged to gain another identity
$this->load->library('AuthLib');
$this->terminateWithSuccess($this->authlib->getAuthObj());
}
/**
* Search for a user in database checking the name, surname or uid
*/
public function searchUser()
{
$query = strtolower('%'.$this->input->get('query').'%');
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$dataset = $this->BenutzerModel->execReadOnlyQuery('
SELECT p.person_id,
b.uid,
p.nachname,
p.vorname,
b.uid,
p.person_id || \' - \' || b.uid || \' - \' || p.nachname || \' \' || p.vorname AS label
FROM public.tbl_person p
LEFT JOIN public.tbl_benutzer b ON(b.person_id = p.person_id)
WHERE b.aktiv = TRUE
AND (p.nachname ILIKE ? OR p.vorname ILIKE ? OR b.uid ILIKE ? OR p.person_id::text LIKE ?)
ORDER BY p.nachname, p.vorname
',
array($query, $query, $query, $query)
);
if (isError($dataset)) $this->terminateWithError(getError($dataset));
$this->terminateWithSuccess($dataset);
}
}
+69 -26
View File
@@ -1,20 +1,4 @@
<?php
/**
* Copyright (C) 2025 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
@@ -24,14 +8,12 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Login extends FHC_Controller
{
/**
* Object initialization
*
*/
public function __construct()
{
parent::__construct(array(
'loginAs' => 'admin:rw'
));
}
{
parent::__construct();
}
/**
* Displays a login page with username and password
@@ -42,11 +24,72 @@ class Login extends FHC_Controller
}
/**
* Displays a login page with username and password
* Called with HTTP POST via ajax to login using the LDAP authentication
*/
public function loginAs()
public function loginLDAP()
{
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->library('AuthLib', array(false)); // without authentication otherwise loooooop!
$login = $this->authlib->loginLDAP($username, $password);
if (isSuccess($login))
{
$this->outputJsonSuccess($this->authlib->getLandingPage()); // if login is success then retrieves the desired page
}
else
{
$this->outputJsonError(getCode($login)); // returns the error code
}
}
/**
* Called with HTTP POST via ajax to login as another user specified by uid
*/
public function loginASByUid()
{
$uid = $this->input->get('uid');
// With authentication -> you must be already logged to gain another identity
$this->load->library('AuthLib');
$loginAS = $this->authlib->loginASByUID($uid);
$this->outputJson($loginAS); // returns the error code
}
/**
* Called with HTTP POST via ajax to login as another user specified by person id
*/
public function loginASByPersonId()
{
$person_id = $this->input->get('person_id');
// With authentication -> you must be already logged to gain another identity
$this->load->library('AuthLib');
$loginAS = $this->authlib->loginASByPersonId($person_id);
if (isSuccess($loginAS))
{
$this->outputJsonSuccess(true); // obtained!
}
else
{
$this->outputJsonSuccess(getCode($loginAS)); // returns the error code
};
}
/**
* To login into the system with email and code as credentials
*/
public function emailCode()
{
}
/**
* To login into the system using SSO
*/
public function sso()
{
$this->load->view('system/login/loginAs');
}
}
@@ -1,37 +0,0 @@
<?php
/**
* Copyright (C) 2025 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$includesArray = array(
'title' => 'Login',
'axios027' => true,
'bootstrap5' => true,
'fontawesome6' => true,
'vue3' => true,
'primevue3' => true,
'phrases' => array('uid', 'global'),
'navigationcomponent' => true,
'customJSModules' => array('public/js/LoginAs.js'),
);
$this->load->view('templates/FHC-Header', $includesArray);
?>
<div id="main"></div>
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
@@ -1,39 +1,44 @@
<?php
/**
* Copyright (C) 2025 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
$includesArray = array(
'title' => 'Login',
'axios027' => true,
'bootstrap5' => true,
'fontawesome6' => true,
'vue3' => true,
'filtercomponent' => true,
'navigationcomponent' => true,
'tabulator5' => true,
'primevue3' => true,
'phrases' => array('uid', 'global'),
'customJSModules' => array('public/js/Login.js'),
);
$this->load->view('templates/FHC-Header', $includesArray);
$this->load->view(
'templates/FHC-Header',
array(
'title' => 'Login',
'jquery3' => true,
'jqueryui1' => true,
'bootstrap3' => true,
'fontawesome4' => true,
'sbadmintemplate3' => true,
'ajaxlib' => true,
'dialoglib' => true,
'customCSSs' => 'public/css/Login.css',
'customJSs' => 'public/js/Login.js'
)
);
?>
<div id="main"></div>
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
<div class="login-form">
<p class="text-center">
<img src="<?php echo base_url('public/images/logo-300x160.png'); ?>" >
</p>
<br>
<div class="form-group">
<input id="username" type="text" class="form-control" placeholder="Username" required="required">
</div>
<div class="form-group">
<input id="password" type="password" class="form-control" placeholder="Password" required="required">
</div>
<div class="form-group">
<button id="btnLogin" ype="submit" class="btn btn-primary btn-block">Log in</button>
</div>
<p class="text-center"><a href="#">Forgot Password?</a></p>
</div>
<?php $this->load->view('templates/FHC-Footer'); ?>
+1 -1
View File
@@ -130,6 +130,6 @@ class basis
*/
public function convert_html_chars($value)
{
return htmlspecialchars($value);
return htmlspecialchars($value ?? '');
}
}
+13 -13
View File
@@ -27,8 +27,8 @@ require_once(dirname(__FILE__).'/basis.class.php');
abstract class db extends basis
{
protected static $db_conn=null;
protected $db_result=null;
protected static $db_conn = null;
protected $db_result = null;
protected $debug=false;
function __construct()
@@ -46,18 +46,18 @@ abstract class db extends basis
abstract function db_connect();
abstract function db_query($sql);
abstract function db_fetch_object($result=null, $i=null);
abstract function db_fetch_array($result=null);
abstract function db_fetch_row($result=null, $i=null);
abstract function db_fetch_assoc($result=null, $i=null);
abstract function db_result($result = null, $i, $item);
abstract function db_num_rows($result=null);
abstract function db_num_fields($result=null);
abstract function db_field_name($result=null, $i);
abstract function db_affected_rows($result=null);
abstract function db_result_seek($result=null, $offset);
abstract function db_fetch_object($result = null, $i = null);
abstract function db_fetch_array($result = null);
abstract function db_fetch_row($result = null, $i = null);
abstract function db_fetch_assoc($result = null, $i = null);
abstract function db_result($result = null, $i = null, $item = null);
abstract function db_num_rows($result = null);
abstract function db_num_fields($result = null);
abstract function db_field_name($result = null, $i = null);
abstract function db_affected_rows($result = null);
abstract function db_result_seek($result = null, $offset = null);
abstract function db_last_error();
abstract function db_free_result($result=null);
abstract function db_free_result($result = null);
abstract function db_version();
abstract function db_escape($var);
abstract function db_null_value($var, $qoute=true);
+9
View File
@@ -33,6 +33,15 @@ class benutzer extends person
public $updateaktivam;
public $updateaktivvon;
// PHP8 adaption
public $mitarbeiter_uid;
public $studiengang;
public $studiengang_kz;
public $telefonklappe;
public $raum;
public $lektor;
public $fixangestellt;
/**
* Konstruktor - Uebergibt die Connection und laedt optional einen Benutzer
* @param $uid Benutzer der geladen werden soll (default=null)
+2 -2
View File
@@ -134,12 +134,12 @@ class benutzerberechtigung extends basis_db
return false;
}
if(mb_strlen($this->berechtigung_kurzbz)>32)
if(mb_strlen($this->berechtigung_kurzbz ?? '')>32)
{
$this->errormsg = 'Berechtigung_kurzbz darf nicht laenger als 32 Zeichen sein';
return false;
}
if(mb_strlen($this->uid)>32)
if(mb_strlen($this->uid ?? '')>32)
{
$this->errormsg = 'UID darf nicht laenger als 32 Zeichen sein';
return false;
+1 -1
View File
@@ -356,7 +356,7 @@ class datum
*/
public function formatDatum($datum, $format='Y-m-d H:i:s', $strict=false)
{
if(trim($datum)=='')
if (trim($datum ?? '') == '')
return '';
$ts='';
+2
View File
@@ -34,6 +34,8 @@ class lehrform extends basis_db
public $bezeichnung_kurz;
public $bezeichnung_lang;
public $lehrform_kurzbz;
/**
* Konstruktor - Laedt optional eine Lehrform
* @param $lehrform_kurbz Lehrform die geladen werden soll (default=null)
+5 -5
View File
@@ -661,27 +661,27 @@ class lehrveranstaltung extends basis_db
public function validate()
{
//Laenge Pruefen
if (mb_strlen($this->bezeichnung) > 128)
if (mb_strlen($this->bezeichnung ?? '') > 128)
{
$this->errormsg = 'Bezeichnung darf nicht laenger als 128 Zeichen sein';
return false;
}
if (mb_strlen($this->kurzbz) > 16)
if (mb_strlen($this->kurzbz ?? '') > 16)
{
$this->errormsg = 'Kurzbez darf nicht laenger als 16 Zeichen sein';
return false;
}
if (mb_strlen($this->anmerkung) > 64)
if (mb_strlen($this->anmerkung ?? '') > 64)
{
$this->errormsg = 'Anmerkung darf nicht laenger als 64 Zeichen sein';
return false;
}
if (mb_strlen($this->lehreverzeichnis) > 16)
if (mb_strlen($this->lehreverzeichnis ?? '') > 16)
{
$this->errormsg = 'Lehreverzeichnis darf nicht laenger als 16 Zeichen sein';
return false;
}
if (mb_strlen($this->lvnr) > 32)
if (mb_strlen($this->lvnr ?? '') > 32)
{
$this->errormsg = 'LVNR darf nicht laenger als 32 Zeichen sein';
return false;
+1
View File
@@ -40,6 +40,7 @@ class lvangebot extends basis_db
protected $anmeldefenster_start; // timestamp
protected $anmeldefenster_ende; // timestamp
protected $updateamum; // timestamp
protected $updatenamum;
protected $updatevon; // varchar(32)
protected $insertamum; // timestamp
protected $insertvon; // varchar(32)
+2 -2
View File
@@ -411,7 +411,7 @@ class mitarbeiter extends benutzer
* @param $datum_bis
* @return boolean
*/
public function getMitarbeiterStg($lektor=true,$fixangestellt, $stge, $fkt_kurzbz, $order='studiengang_kz, nachname, vorname, kurzbz', $datum_von='', $datum_bis='')
public function getMitarbeiterStg($lektor = true, $fixangestellt = null, $stge = null, $fkt_kurzbz = '', $order = 'studiengang_kz, nachname, vorname, kurzbz', $datum_von = '', $datum_bis = '')
{
$sql_query='SELECT DISTINCT campus.vw_mitarbeiter.*, studiengang_kz, tbl_studiengang.typ, tbl_studiengang.kurzbz AS stg_kurzbz FROM campus.vw_mitarbeiter
JOIN public.tbl_benutzerfunktion USING (uid) JOIN public.tbl_studiengang USING(oe_kurzbz)
@@ -1554,7 +1554,7 @@ class mitarbeiter extends benutzer
* @param $studSemArray Array mit Studiensemestern in denen der externe Lektor zumindest in einem Unterrichtet haben soll oder NULL. Wenn NULL werden nur externe Mitarbeiter ohne Lehrauftrag ausgegeben.
* @return boolean
*/
public function getMitarbeiterForZutrittskarte($filter, $fixangestellt=true, $studSemArray)
public function getMitarbeiterForZutrittskarte($filter, $fixangestellt=true, $studSemArray=array())
{
$qry = "SELECT
vorname,nachname,gebdatum,uid,personalnummer,person_id
+3
View File
@@ -49,6 +49,9 @@ class organisationseinheit extends basis_db
public $beschreibung;
public $oetyp_bezeichnung;
public $kurzzeichen;
public $freigabegrenze;
/**
* Konstruktor
+13 -13
View File
@@ -44,7 +44,7 @@ class basis_db extends db
public function db_query($sql)
{
if ($this->db_result=pg_query(basis_db::$db_conn,$sql))
if ($this->db_result = @pg_query(basis_db::$db_conn,$sql))
return $this->db_result;
else
{
@@ -53,7 +53,7 @@ class basis_db extends db
}
}
public function db_num_rows($result=null)
public function db_num_rows($result = null)
{
if(is_null($result))
return pg_num_rows($this->db_result);
@@ -61,7 +61,7 @@ class basis_db extends db
return pg_num_rows($result);
}
public function db_fetch_object($result = null, $i=null)
public function db_fetch_object($result = null, $i = null)
{
if(is_null($result))
{
@@ -79,7 +79,7 @@ class basis_db extends db
}
}
public function db_fetch_row($result = null, $i=null)
public function db_fetch_row($result = null, $i = null)
{
if(is_null($result))
{
@@ -97,7 +97,7 @@ class basis_db extends db
}
}
public function db_fetch_assoc($result = null, $i=null)
public function db_fetch_assoc($result = null, $i = null)
{
if(is_null($result))
{
@@ -115,7 +115,7 @@ class basis_db extends db
}
}
public function db_result($result = null, $i,$item)
public function db_result($result = null, $i = null, $item = null)
{
if(is_null($result))
{
@@ -153,10 +153,10 @@ class basis_db extends db
public function db_last_error()
{
return pg_last_error();
return pg_last_error(basis_db::$db_conn);
}
public function db_affected_rows($result=null)
public function db_affected_rows($result = null)
{
if(is_null($result))
return pg_affected_rows($this->db_result);
@@ -164,7 +164,7 @@ class basis_db extends db
return pg_affected_rows($result);
}
public function db_result_seek($result=null, $offset)
public function db_result_seek($result = null, $offset = null)
{
if(is_null($result))
return pg_result_seek($this->db_result, $offset);
@@ -172,7 +172,7 @@ class basis_db extends db
return pg_result_seek($result, $offset);
}
public function db_fetch_array($result=null, $row=null, $result_type=PGSQL_NUM)
public function db_fetch_array($result = null, $row = null, $result_type=PGSQL_NUM)
{
if(is_null($result))
return pg_fetch_array($this->db_result, $row, $result_type);
@@ -180,7 +180,7 @@ class basis_db extends db
return pg_fetch_array($result, $row, $result_type);
}
public function db_num_fields($result=null)
public function db_num_fields($result = null)
{
if(is_null($result))
return pg_num_fields($this->db_result);
@@ -191,7 +191,7 @@ class basis_db extends db
/**
* Liefert den Feldnamen mit index i
*/
public function db_field_name($result=null, $i)
public function db_field_name($result = null, $i = null)
{
if(is_null($result))
return pg_field_name($this->db_result, $i);
@@ -230,7 +230,7 @@ class basis_db extends db
*/
public function db_escape($var)
{
return pg_escape_string($var);
return pg_escape_string(basis_db::$db_conn, $var);
}
/**
+5
View File
@@ -68,6 +68,11 @@ class studiengang extends basis_db
public $beschreibung;
public $studiengang_typ_arr = array(); // Array mit den Studiengangstypen
public $telefon;
public $aktiv;
public $beantragung;
public $lgart_biscode;
/**
* Konstruktor
* @param studiengang_kz Kennzahl des zu ladenden Studienganges
+49 -73
View File
@@ -1,79 +1,55 @@
/**
* Copyright (C) 2025 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* To login via LDAP
*/
function loginLDAP()
{
// Ajax call to login with LDAP
FHC_AjaxClient.ajaxCallPost(
"system/Login/loginLDAP",
{
username: $("#username").val(),
password: $("#password").val()
},
{
successCallback: function(data, textStatus, jqXHR) {
import PluginsPhrasen from '../js/plugins/Phrasen.js';
import ApiLogin from '../js/api/factory/login.js';
const loginApp = Vue.createApp({
data: function() {
return {
username: '',
password: ''
};
},
components: {
},
methods: {
loginLDAP: function() {
this.$api
.call(ApiLogin.loginLDAP({
username: this.username,
password: this.password
}))
.then((response) => {
// If property data exists
if (Object.hasOwn(response, 'data'))
if (FHC_AjaxClient.isError(data))
{
if (FHC_AjaxClient.getError(data) == 10)
{
// If property data is a string
if (typeof response.data === 'string' || response.data instanceof String)
{
// If property data is a valid URL
try {
let url = new URL(response.data);
// If here the URL contained in response.data is fine
// and can be used to switch to the landing page
document.location.href = response.data;
} catch (_) {}
}
FHC_DialogLib.alertError("Username not foud");
}
})
.catch((error) => {
console.error(error);
});
}
},
template: `
<div class="d-flex align-items-center justify-content-center">
<div>
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" name="username" id="username" v-model="username">
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" name="password" id="password" v-model="password">
</div>
<div class="d-flex align-items-center justify-content-center">
<button type="button" class="btn btn-primary" @click="loginLDAP">Login</button>
</div>
</div>
</div>
`
if (FHC_AjaxClient.getError(data) == 2)
{
FHC_DialogLib.alertError("Wrong password");
}
}
else
{
$(location).attr("href", FHC_AjaxClient.getData(data));
}
},
errorCallback: function(jqXHR, textStatus, errorThrown) {
FHC_DialogLib.alertError(textStatus);
}
}
);
}
/**
* When JQuery is up
*/
$(document).ready(function() {
$("#btnLogin").click(loginLDAP);
$("#username").keydown(function(e) {
if (e.keyCode == 13) loginLDAP();
})
$("#password").keydown(function(e) {
if (e.keyCode == 13) loginLDAP();
})
});
loginApp.use(PluginsPhrasen).mount('#main');
-168
View File
@@ -1,168 +0,0 @@
/**
* Copyright (C) 2025 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import PluginsPhrasen from '../js/plugins/Phrasen.js';
import ApiLogin from '../js/api/factory/login.js';
import {CoreNavigationCmpt} from '../js/components/navigation/Navigation.js';
import PvAutoComplete from "../../index.ci.php/public/js/components/primevue/autocomplete/autocomplete.esm.min.js";
const loginAsApp = Vue.createApp({
data: function() {
return {
person_id: '',
username: '',
surname: '',
name: '',
selectedUser: null,
filteredUsers: [],
appSideMenuEntries: {}
};
},
components: {
CoreNavigationCmpt,
PvAutoComplete
},
methods: {
loginAs: function() {
if (this.selectedUser != null)
{
this.$api
.call(ApiLogin.loginASByUid({
uid: this.selectedUser.uid
}))
.then((response) => {
location.reload();
})
.catch((error) => {
console.error(error);
});
}
},
logout: function() {
this.$api
.call(ApiLogin.logout())
.then((response) => {
location.reload();
})
.catch((error) => {
console.error(error);
});
},
searchUser: function(event) {
if (event.query.length >= 3)
{
this.$api
.call(ApiLogin.searchUser(event.query))
.then(result => {
this.filteredUsers = result.data.retval;
})
.catch((error) => {
console.error(error);
});
}
}
},
mounted: function() {
this.$api
.call(ApiLogin.whoAmI())
.then((response) => {
// If property data exists
if (Object.hasOwn(response, 'data'))
{
if (response.data != null && Object.hasOwn(response.data, 'person_id'))
{
this.person_id = response.data.person_id;
this.username = response.data.username;
this.surname = response.data.surname;
this.name = response.data.name;
}
else
{
this.person_id = 'Not logged';
this.username = 'Not logged';
this.surname = 'Not logged';
this.name = 'Not logged';
}
}
})
.catch((error) => {
console.error(error);
});
},
template: `
<!-- Navigation component -->
<core-navigation-cmpt v-bind:add-side-menu-entries="appSideMenuEntries"></core-navigation-cmpt>
<div style="width: 700px !important">
<div class="card" style="padding: 20px;">
<div class="mb-3">
Who am I?
</div>
<div class="mb-3">
<div class="d-inline-flex align-items-center">
<label for="person_id" class="form-label" style="width: 150px !important">Person ID</label>
<input type="text" style="width: 400px !important" disabled="disabled" class="form-control" id="person_id" v-model="person_id">
</div>
</div>
<div class="mb-3">
<div class="d-inline-flex align-items-center">
<label for="username" class="form-label" style="width: 150px !important">UID</label>
<input type="text" style="width: 400px !important" disabled="disabled" class="form-control" id="username" v-model="username">
</div>
</div>
<div class="mb-3">
<div class="d-inline-flex align-items-center">
<label for="surname" class="form-label" style="width: 150px !important">Surname</label>
<input type="text" style="width: 400px !important" disabled="disabled" class="form-control" id="surname" v-model="surname">
</div>
</div>
<div class="mb-3">
<div class="d-inline-flex align-items-center">
<label for="name" class="form-label" style="width: 150px !important">Name</label>
<input type="text" style="width: 400px !important" disabled="disabled" class="form-control" id="name" v-model="name">
</div>
</div>
<div class="d-flex align-items-center justify-content-center">
<button type="button" class="btn btn-primary" @click="logout">Logout</button>
</div>
</div>
<div class="card" style="padding: 20px;">
<div class="mb-3">
Who I want to be?
</div>
<div class="mb-3">
<div class="d-inline-flex align-items-center">
<PvAutoComplete inputStyle="width: 600px;" v-model="selectedUser" optionLabel="label" :suggestions="filteredUsers" @complete="searchUser" placeholder="Search user..." />
</div>
</div>
<div class="d-flex align-items-center justify-content-center">
<button type="button" class="btn btn-primary" @click="loginAs">Login as</button>
</div>
</div>
</div>
`
});
loginAsApp.
use(PluginsPhrasen).
use(primevue.config.default, {
zIndex: {
overlay: 1100
}
}).
mount('#main');
-59
View File
@@ -1,59 +0,0 @@
/**
* Copyright (C) 2025 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export default {
loginLDAP(params) {
return {
method: 'post',
url: '/api/frontend/v1/Login/loginLDAP',
params
};
},
loginASByUid(params) {
return {
method: 'post',
url: '/api/frontend/v1/Login/loginASByUid',
params
};
},
loginASByPersonId(params) {
return {
method: 'post',
url: '/api/frontend/v1/Login/loginASByPersonId',
params
};
},
whoAmI() {
return {
method: 'get',
url: '/api/frontend/v1/Login/whoAmI'
};
},
logout() {
return {
method: 'get',
url: '/system/Logout'
};
},
searchUser(query) {
return {
method: 'get',
url: '/api/frontend/v1/Login/searchUser?query=' + encodeURIComponent(query)
};
}
};
+2 -2
View File
@@ -211,7 +211,7 @@
<td>Kurzbz*</td>
<td><input type="text" name="kurzbz" '.($lv->lehrveranstaltung_id==''?'onchange="copyToLehreVz();"':'onchange="return copyToLehreVzAsk();"').' value="'.$lv->kurzbz.'" /></td>
<td>Bezeichnung*</td>
<td colspan=3><input type="text" name="bezeichnung" value="'.htmlentities($lv->bezeichnung, ENT_QUOTES, 'UTF-8').'" size="60" maxlength="128"></td>
<td colspan=3><input type="text" name="bezeichnung" value="'.htmlentities($lv->bezeichnung ?? '', ENT_QUOTES, 'UTF-8').'" size="60" maxlength="128"></td>
</tr>
<tr>
<td>Sprache</td>
@@ -227,7 +227,7 @@
}
$htmlstr .= '</select></td>
<td>Bezeichnung English</td>
<td colspan=3><input type="text" name="bezeichnung_english" value="'.htmlentities($lv->bezeichnung_english, ENT_QUOTES, 'UTF-8').'" size="60" maxlength="256"></td>
<td colspan=3><input type="text" name="bezeichnung_english" value="'.htmlentities($lv->bezeichnung_english ?? '', ENT_QUOTES, 'UTF-8').'" size="60" maxlength="256"></td>
</tr><tr>
<td>Studiengang</td>
<td><select name="studiengang_kz">';
@@ -725,7 +725,7 @@ if (isset($_REQUEST['uid']) || isset($_REQUEST['funktion_kurzbz']))
$htmlstr .= '</a></p>';
}
}
if (count($bn) > 0)
if (count($bn->berechtigungen) > 0)
{
$htmlstr .= "<p><a href='benutzerberechtigung_detailliste.php?uid=$uid' target='_blank'>Rechte Detailaufschlüsselung</a></p>";
}
@@ -928,7 +928,7 @@ if (isset($_REQUEST['uid']) || isset($_REQUEST['funktion_kurzbz']))
$data = 'gruen';
}
// Inaktive Elemente sowie WaWi-Rechte ausblenden
if ($b->ende!='' && strtotime($b->ende) < $heute || $b->rolle_kurzbz == 'wawi' || substr($b->berechtigung_kurzbz, 0, 4) == 'wawi')
if ($b->ende!='' && strtotime($b->ende) < $heute || $b->rolle_kurzbz == 'wawi' || substr($b->berechtigung_kurzbz ?? '', 0, 4) == 'wawi')
{
$htmlstr .= " <tr class='row_berechtigung ausgeblendet' id='".$b->benutzerberechtigung_id."'>";
$countInaktiveUndWawi++;
@@ -1061,7 +1061,7 @@ if (isset($_REQUEST['uid']) || isset($_REQUEST['funktion_kurzbz']))
name='dataset[$b->benutzerberechtigung_id][anmerkung]'
class='input_anmerkung $inaktiv_class'
value='".$b->anmerkung."'
title='".$db->convert_html_chars(mb_eregi_replace('\r'," ",$b->anmerkung))."'
title='".$db->convert_html_chars(mb_eregi_replace('\r'," ",$b->anmerkung ?? ''))."'
data-toggle='tooltip'
data-html='true'
data-placement='auto'