diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod index f6632a173eb5a0efa60679c5cf0cf5dce380f372..8b3f481d0a44dc3b9a9130dd77113eacbafb79e0 100644 --- a/entity/Appointment_entity/Appointment_entity.aod +++ b/entity/Appointment_entity/Appointment_entity.aod @@ -5,6 +5,8 @@ <documentation>%aditoprj%/entity/Appointment_entity/documentation.adoc</documentation> <title>Appointment</title> <siblings /> + <grantUpdateProcess>%aditoprj%/entity/Appointment_entity/grantUpdateProcess.js</grantUpdateProcess> + <grantDeleteProcess>%aditoprj%/entity/Appointment_entity/grantDeleteProcess.js</grantDeleteProcess> <afterUiInit>%aditoprj%/entity/Appointment_entity/afterUiInit.js</afterUiInit> <titlePlural>Appointments</titlePlural> <recordContainer>jdito</recordContainer> diff --git a/entity/Appointment_entity/grantDeleteProcess.js b/entity/Appointment_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4caa2d99cfdda2637190ab5c76a15565666b79b5 --- /dev/null +++ b/entity/Appointment_entity/grantDeleteProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("system.calendars"); +import("system.text"); + +var owner = text.decodeMS(JSON.parse(vars.get("$param.Entry_param"))["h"])[1].split(":")[1]; +result.string(calendars.hasPermission([owner], calendars.VEVENT, "WRITE")); \ No newline at end of file diff --git a/entity/Appointment_entity/grantUpdateProcess.js b/entity/Appointment_entity/grantUpdateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3562ea4a6c4ba8fda784eb7ea85abd591e022f87 --- /dev/null +++ b/entity/Appointment_entity/grantUpdateProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); +import("system.calendars"); +import("system.text"); + +var owner = text.decodeMS(JSON.parse(vars.get("$param.Entry_param"))["h"])[1].split(":")[1]; +result.string(calendars.hasPermission([owner], calendars.VEVENT, "WRITE")); + diff --git a/process/Appointment_lib/process.js b/process/Appointment_lib/process.js index 66eabd04b1983a22cb7c2b1b477f3b7ae9bb8218..c40c2d134dfd8ea6d7cc2d5b24d964bf80cbefc2 100644 --- a/process/Appointment_lib/process.js +++ b/process/Appointment_lib/process.js @@ -157,8 +157,9 @@ AppointmentUtils.setAppointmentLinkComponentState = function(pSysRecordstate, pA { var currentUserId = CalendarUtil.getEffectiveCalendarIdFromUser(tools.getCurrentUser()); var organzierId = CalendarUtil.getEffectiveCalendarIdFromUser(tools.getUser(entry[calendars.ORGANIZER2]["cn"], tools.PROFILE_DEFAULT)); + var owner = text.decodeMS(entry["h"])[1].split(":")[1] - if(currentUserId && currentUserId == organzierId) + if(currentUserId && currentUserId == organzierId || calendars.hasPermission([owner], calendars.VEVENT, "WRITE")) return neon.COMPONENTSTATE_EDITABLE; else return neon.COMPONENTSTATE_DISABLED;