implemented permission for viewing other users' lv plans

This commit is contained in:
adisposkofh
2026-04-13 15:44:09 +02:00
parent f1c3c8296f
commit 7daaf79fcc
12 changed files with 263 additions and 188 deletions
+3
View File
@@ -79,6 +79,9 @@ class Profil extends Auth_Controller
$viewData = array (
'uid' => $uid,
'profil_data'=>$profil_data,
'permissions' => [
'basis/other_lv_plan' => $this->permissionlib->isBerechtigt(('basis/other_lv_plan')),
]
);
if($uid == getAuthUID()){
$viewData['editable'] = true;
+7 -6
View File
@@ -1,6 +1,7 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/**
*
@@ -13,9 +14,9 @@ class Cis4 extends Auth_Controller
public function __construct()
{
parent::__construct(
array(
'index' => 'basis/cis:r'
)
array(
'index' => 'basis/cis:r'
)
);
// Load Config
@@ -32,12 +33,12 @@ class Cis4 extends Auth_Controller
{
$this->load->model('person/Person_model', 'PersonModel');
$personData = getData($this->PersonModel->getByUid(getAuthUID()))[0];
$viewData = array(
'uid' => getAuthUID(),
'name' => $personData->vorname,
'person_id' => $personData->person_id,
'timezone' => $this->config->item('timezone')
'timezone' => $this->config->item('timezone'),
);
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'FhcDashboard']);
@@ -47,7 +47,7 @@ class LvPlan extends FHCAPI_Controller
'fetchFerienEvents' => self::PERM_LOGGED,
'getStudiengaenge' => self::PERM_LOGGED,
'getLehrverband' => self::PERM_LOGGED,
'permissionOtherLvPlan' => self::PERM_LOGGED,
]);
$this->load->library('LogLib');
@@ -378,6 +378,16 @@ class LvPlan extends FHCAPI_Controller
return $this->terminateWithSuccess($data);
}
/**
* Checks if the current user has permission to view other users' timetables
*
* @return void
*/
public function permissionOtherLvPlan()
{
$this->terminateWithSuccess($this->permissionlib->isBerechtigt('basis/other_lv_plan'));
}
/**
* fetch moodle events
*
+6
View File
@@ -118,4 +118,10 @@ export default {
url: `/api/frontend/v1/lvPlan/getLehrverband/${stg_kz}/${sem}/${verband}`
}
},
checkPermissionOtherLvPlan(){
return {
method: 'get',
url: '/api/frontend/v1/lvPlan/permissionOtherLvPlan',
}
}
};
+150 -121
View File
@@ -1,172 +1,201 @@
import FhcSearchbar from "../components/searchbar/searchbar.js";
import CisMenu from "../components/Cis/Menu.js";
import PluginsPhrasen from '../plugins/Phrasen.js';
import ApiSearchbar from '../api/factory/searchbar.js';
import PluginsPhrasen from "../plugins/Phrasen.js";
import Theme from "../plugins/Theme.js";
import ApiSearchbar from "../api/factory/searchbar.js";
import ApiLvPlan from "../api/factory/lvPlan.js";
const app = Vue.createApp({
name: 'CisApp',
components: {
FhcSearchbar,
CisMenu
},
data: function() {
return {
searchbaroptions: {
name: "CisApp",
components: {
FhcSearchbar,
CisMenu,
},
data: function () {
return {
searchbaroptions: {
origin: "cis",
cssclass: "",
calcheightonly: true,
types: {
employee: Vue.computed(() => this.$p.t("search/type_employee")),
student: Vue.computed(() => this.$p.t("search/type_student")),
employee: Vue.computed(() =>
this.$p.t("search/type_employee"),
),
student: Vue.computed(() =>
this.$p.t("search/type_student"),
),
room: Vue.computed(() => this.$p.t("search/type_room")),
organisationunit: Vue.computed(() => this.$p.t("search/type_organisationunit")),
organisationunit: Vue.computed(() =>
this.$p.t("search/type_organisationunit"),
),
cms: Vue.computed(() => this.$p.t("search/type_cms")),
dms: Vue.computed(() => this.$p.t("search/type_dms"))
dms: Vue.computed(() => this.$p.t("search/type_dms")),
},
actions: {
employee: {
defaultaction: {
type: "link",
action: function(data) {
return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+
"/Cis/Profil/View/"+data.uid;
}
actions: {
employee: {
defaultaction: {
type: "link",
action: function (data) {
return (
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/Cis/Profil/View/" +
data.uid
);
},
},
childactions: [
{
label: Vue.computed(() => this.$p.t("lehre/stundenplan")),
icon: "fas fa-calendar-days",
type: "link",
action: function(data) {
const uid = JSON.parse(data.data).uid;
const link = FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/Cis/OtherLvPlan/' + uid;
return link;
}
}
]
childactions: [],
},
student: {
defaultaction: {
type: "link",
action: function (data) {
return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/Cis/Profil/View/" + data.uid;
}
return (
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/Cis/Profil/View/" +
data.uid
);
},
},
childactions: [
{
label: Vue.computed(() => this.$p.t("lehre/stundenplan")),
icon: "fas fa-calendar-days",
type: "link",
action: function(data) {
const uid = JSON.parse(data.data).uid;
const link = FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/Cis/OtherLvPlan/' + uid;
return link;
}
}
]
childactions: [],
},
room: {
defaultaction: {
type: "link",
renderif: function(data) {
if(data.content_id === null){
room: {
defaultaction: {
type: "link",
renderif: function (data) {
if (data.content_id === null) {
return false;
}
return true;
},
action: function(data) {
const link= FHC_JS_DATA_STORAGE_OBJECT.app_root +
action: function (data) {
const link =
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/CisVue/Cms/content/' + data.content_id;
"/CisVue/Cms/content/" +
data.content_id;
return link;
}
},
childactions: [
{
label: "LV-Plan",
icon: "fas fa-bookmark",
type: "link",
action: function(data) {
const link = FHC_JS_DATA_STORAGE_OBJECT.app_root +
},
},
childactions: [
{
label: "LV-Plan",
icon: "fas fa-bookmark",
type: "link",
action: function (data) {
const link =
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/CisVue/Cms/getRoomInformation/' + data.ort_kurzbz;
"/CisVue/Cms/getRoomInformation/" +
data.ort_kurzbz;
return link;
}
},
{
label: "Rauminformation",
icon: "fas fa-info-circle",
type: "link",
renderif: function(data) {
if(data.content_id === null){
},
},
{
label: "Rauminformation",
icon: "fas fa-info-circle",
type: "link",
renderif: function (data) {
if (data.content_id === null) {
return false;
}
return true;
},
action: function(data) {
const link= FHC_JS_DATA_STORAGE_OBJECT.app_root +
},
action: function (data) {
const link =
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/CisVue/Cms/content/' + data.content_id;
"/CisVue/Cms/content/" +
data.content_id;
return link;
}
},
]
},
organisationunit: {
defaultaction: {
type: "link",
renderif: function(data) {
if(data.mailgroup) {
},
},
],
},
organisationunit: {
defaultaction: {
type: "link",
renderif: function (data) {
if (data.mailgroup) {
return true;
}
return false;
},
action: function(data) {
const link = 'mailto:' + data.mailgroup;
action: function (data) {
const link = "mailto:" + data.mailgroup;
return link;
}
},
childactions: []
},
},
},
childactions: [],
},
cms: {
defaultaction: {
type: "link",
action: function (data) {
const link = FHC_JS_DATA_STORAGE_OBJECT.app_root +
const link =
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
'/CisVue/Cms/content/' + data.content_id;
"/CisVue/Cms/content/" +
data.content_id;
return link;
}
},
},
childactions: []
childactions: [],
},
dms: {
defaultaction: {
type: "link",
action: function (data) {
const link = FHC_JS_DATA_STORAGE_OBJECT.app_root +
'cms/dms.php?id=' + data.dms_id;
const link =
FHC_JS_DATA_STORAGE_OBJECT.app_root +
"cms/dms.php?id=" +
data.dms_id;
return link;
}
},
},
childactions: []
}
}
}
};
},
methods: {
searchfunction: function(searchsettings) {
return this.$api.call(ApiSearchbar.searchCis(searchsettings));
}
}
childactions: [],
},
},
},
};
},
methods: {
searchfunction: function (searchsettings) {
return this.$api.call(ApiSearchbar.searchCis(searchsettings));
},
},
async mounted() {
const openOtherLvPlanAction = {
label: Vue.computed(() => this.$p.t("lehre/stundenplan")),
icon: "fas fa-calendar-days",
type: "link",
action: function (data) {
const uid = JSON.parse(data.data).uid;
const link =
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/Cis/OtherLvPlan/" +
uid;
return link;
},
};
let checkPermissionOtherLvPlanResult = await this.$api.call(
ApiLvPlan.checkPermissionOtherLvPlan(),
);
if (
checkPermissionOtherLvPlanResult.meta.status === "success" &&
checkPermissionOtherLvPlanResult.data
) {
this.searchbaroptions.actions.employee.childactions.push(
openOtherLvPlanAction,
);
this.searchbaroptions.actions.student.childactions.push(
openOtherLvPlanAction,
);
}
},
});
FhcApps.makeExtendable(app);
@@ -174,9 +203,9 @@ FhcApps.makeExtendable(app);
app.use(primevue.config.default, {
zIndex: {
overlay: 9000,
tooltip: 8000
}
})
tooltip: 8000,
},
});
app.use(PluginsPhrasen);
app.use(Theme);
app.mount('#cis-header');
app.mount("#cis-header");
@@ -103,18 +103,7 @@ export default {
},
],
},
quickLinks: [
{
icon: "fa-calendar-days",
phrase: "lehre/stundenplan",
action: () => {
this.$router.push({
name: "OtherLvPlan",
params: { otherUid: this.$props.data.username },
})
},
}
],
quickLinks: [],
betriebsmittel_table_options: {
persistenceID: "filterTableMaProfilBetriebsmittel",
persistence: {
@@ -90,23 +90,12 @@ export default {
},
],
},
quickLinks: [
{
icon: "fa-calendar-days",
phrase: "lehre/stundenplan",
action: () => {
this.$router.push({
name: "OtherLvPlan",
params: { otherUid: this.$props.data.username },
})
},
}
],
quickLinks: [],
};
},
//? this is the prop passed to the dynamic component with the custom data of the view
props: ["data"],
props: ["data", "permissions"],
methods: {
funktionenTableBuilt: function () {
this.$refs.funktionenTable.tabulator.setData(this.data.funktionen);
@@ -201,6 +190,21 @@ export default {
this.preloadedPhrasen.wochenstundenPhrase = this.$p.t('profil/wochenstunden');
this.preloadedPhrasen.loaded = true;
});
if (this.$props.permissions["basis/other_lv_plan"]) {
this.quickLinks.push(
{
icon: "fa-calendar-days",
phrase: "lehre/stundenplan",
action: () => {
this.$router.push({
name: "OtherLvPlan",
params: { otherUid: this.$props.data.username },
})
},
}
);
}
},
template: /*html*/ `
+2 -2
View File
@@ -379,7 +379,7 @@ export const Profil = {
}
},
created() {
this.load()
this.load();
},
template: `
<div>
@@ -388,7 +388,7 @@ export const Profil = {
</div>
<div v-else>
<loading ref="loadingModalRef" :timeout="0"></loading>
<component :is="view" :data="data" :editData="filteredEditData" ></component>
<component :is="view" :data="data" :permissions="$props.viewData.permissions" :editData="filteredEditData" ></component>
</div>
</div>`,
}
@@ -95,18 +95,7 @@ export default {
},
],
},
quickLinks: [
{
icon: "fa-calendar-days",
phrase: "lehre/stundenplan",
action: () => {
this.$router.push({
name: "OtherLvPlan",
params: { otherUid: this.$props.data.username },
})
},
}
],
quickLinks: [],
};
},
@@ -5,22 +5,6 @@ import ProfilInformation from "./ProfilComponents/ProfilInformation.js";
import QuickLinks from "./ProfilComponents/QuickLinks.js";
export default {
data() {
return {
quickLinks: [
{
icon: "fa-calendar-days",
phrase: "lehre/stundenplan",
action: () => {
this.$router.push({
name: "OtherLvPlan",
params: { otherUid: this.$props.data.username },
})
},
}
],
};
},
components: {
Mailverteiler,
ProfilEmails,
@@ -28,16 +12,17 @@ export default {
ProfilInformation,
QuickLinks,
},
props: ["data"],
props: ["data", "permissions"],
data() {
return {
quickLinks: [],
};
},
provide() {
return {
studiengang_kz: Vue.computed({ get: () => this.data.studiengang_kz }),
}
},
methods: {},
computed: {
fotoStatus() {
return this.data?.fotoStatus ?? null;
@@ -101,6 +86,23 @@ export default {
};
},
},
methods: {},
created() {
if (this.$props.permissions["basis/other_lv_plan"]) {
this.quickLinks.push(
{
icon: "fa-calendar-days",
phrase: "lehre/stundenplan",
action: () => {
this.$router.push({
name: "OtherLvPlan",
params: { otherUid: this.$props.data.username },
})
},
}
);
}
},
template: /*html*/ `
<div class="container-fluid text-break fhc-form" >
+1
View File
@@ -93,6 +93,7 @@ require_once('dbupdate_3.4/62889_reihungstest_ueberwachung_mit_constructor.php')
require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php');
require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php');
require_once('dbupdate_3.4/71566_studienordnungsdokument_neuer_organisationseinheitstyp_programm.php');
require_once('dbupdate_3.4/76150_perm_other_lv_plan.php');
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
@@ -0,0 +1,41 @@
<?php
/* Copyright (C) 2017 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Harald Bamberger <harald.bamberger@technikum-wien.at>,
*
* Beschreibung:
* Permission basis/other_lv_plan
*/
if (! defined('DB_NAME')) exit('No direct script access allowed');
// Add permission: basis/gehaelter
if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berechtigung_kurzbz = 'basis/other_lv_plan';"))
{
if($db->db_num_rows($result) == 0)
{
$qry = "INSERT INTO system.tbl_berechtigung(berechtigung_kurzbz, beschreibung) VALUES('basis/other_lv_plan', 'Permission holder can view other users timetables (LV plans)');";
if(!$db->db_query($qry))
{
echo '<strong>system.tbl_berechtigung '.$db->db_last_error().'</strong><br>';
}
else
{
echo 'system.tbl_berechtigung: Added permission "basis/other_lv_plan"<br>';
}
}
}