0

I want to give permissions of adding event in calendar to some user and for some users it has to be disabled. How can I achieve it programatically ?

Pete
  • 57,112
  • 28
  • 117
  • 166
Vinita Shah
  • 118
  • 2
  • 13
  • I have given permissions to Specific roles from calendar portlet's permission tab. but add event button is still enable for all the users. I havnt any idea about how to do it programatically. – Vinita Shah May 11 '16 at 07:32
  • You could hook the jsp and make the add button just visible in case of having that role – Jorge May 11 '16 at 11:47
  • @jorge....But i cant find when and where add event button is added and how to disable it... – Vinita Shah May 11 '16 at 11:53
  • @VinitaShah: Please update your question on what you have tried with roles and permission, that will help everyone to understand the scenario? – Pankaj Kathiriya May 11 '16 at 14:33
  • @PankajkumarKathiriya : I got the solution as i have posted it but I am trying to disable add event button only if manage events permission is not given to that user. but i cant find the condition for that. – Vinita Shah May 12 '16 at 06:07
  • calendar portlet is a plugin from LR6.2 on, and it is not in Liferay portal classloader anymore. You cannot hook its jsps the way we used to. You have to extend the calendar plugin. See https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/creating-plugins-to-extend-plugins – Juan Manuel Rogado May 12 '16 at 15:56

1 Answers1

1

showAddEventBtn = false; will do the trick for you.

Put this line after boolean showAddEventBtn = ParamUtil.getBoolean(request, "showAddEventBtn"); in scheduler.jsp

It will disable the add event Button..

Parkash Kumar
  • 4,710
  • 3
  • 23
  • 39
Vinita Shah
  • 118
  • 2
  • 13
  • Additionally, you can control this code, based on permission setup. – Parkash Kumar May 12 '16 at 06:16
  • But I cant find the condition to check if user has given permission to manage events.. I have tried this condition, CalendarPermission.contains(permissionChecker, userDefaultCalendar, ActionKeys.MANAGE_BOOKINGS) But it is not working – Vinita Shah May 12 '16 at 06:29
  • Where are you setting this parameter? – Parkash Kumar May 12 '16 at 07:12
  • You can try adding following lines in `view_calendar.jsp` before `viewCalendarBookingURL`: `String showAddEventBtn = String.valueOf((userDefaultCalendar != null) && CalendarPermission.contains(permissionChecker, userDefaultCalendar, ActionKeys.MANAGE_BOOKINGS)); ` – Parkash Kumar May 12 '16 at 07:18
  • @prakash Kumar.....I have tried to put condition in view_calendar.jsp but It is not working... – Vinita Shah May 12 '16 at 08:38
  • Not working in a sense? Button is appearing or button is not appearing? – Parkash Kumar May 12 '16 at 08:38
  • What does this condition evaluates? – Parkash Kumar May 12 '16 at 11:25
  • I have written condition like , CalendarPermission.contains(permissionChecker, userDefaultCalendar, ActionKeys.MANAGE_BOOKINGS) For checking if it has manage_events Permission or not...But it is not evaluating properly.. – Vinita Shah May 12 '16 at 11:55