How to restrict access to calendar

vprahal wrote on Wednesday, October 02, 2013:

I want a user to be able to see only his calendar and not other users/administrator’s calendar. The administrator needs to be able to see all the users’ calendars. How can I do that?

visolveemr wrote on Thursday, October 03, 2013:

Hi,

There is no functionality in ACL to do this at present. You need to customize the calendar module to achieve your needs.

Basically in openEMR, there are two types of users. Providers and non- Providers. Generally providers can create his appointments but non-providers can able to select and create appointments for other providers.

In other words, mostly the front office staffs will not be a provider - but they need to create appointments for all the other providers in their clinic(so they should be able to view all provider’s calendar).

We can help you more, if you explore more about your needs.

Thanks
OpenEMR Customization/Support provider,
ViSolve,Inc
services@visolve.com

vprahal wrote on Thursday, October 03, 2013:

Hi ViSolve,

Thanks for the reply. How can I customize the calendar module? I am quite new to OpenEMR and the Q may sound silly, but pls excuse me if it is.

Thanks

visolveemr wrote on Friday, October 04, 2013:

Hi,

This can be accomplished by doing the following changes in the file:

interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/ajax_template.html

309 - if (count($facilities) > 1 && acl_check('admin', 'super')) {
322 - if((acl_check('admin', 'super'))){
334 - 
}
else if(!(acl_check('admin', 'super'))){
 echo "</div>";
 echo "   <select multiple size='5' name='pc_username[]' id='pc_username' class='view2'>\n";
 foreach ($provinfo as $doc) { 
if ( $doc['username']==$_SESSION["authUser"])
{
		$username = $doc['username'];
		echo "    <option value='$username'";
		foreach ($providers as $provider)
    		if ($provider['username'] == $username) echo " selected";
		echo ">" . htmlspecialchars($doc['lname'],ENT_QUOTES) . ", " . htmlspecialchars($doc['fname'],ENT_QUOTES) . "</option>\n";
}
  }
  echo "   </select>\n";
}

This is for the day view of the calendar. You need to incorporate similar changes for the week and month view too.

This code will allow the administrator users to view all the providers calendar and a non-administrator users(providers) to view only their calendar.

However, this will not work in the case of a non provider (eg: a front office person). We can help you more, if you share your expectation in this scenario.

Thanks
OpenEMR Customization/Support provider,
ViSolve,Inc
services@visolve.com

vprahal wrote on Sunday, October 13, 2013:

Hi ViSolve,

thanks for the reply. I don’t know exactly where to insert this code. Do I have to replace any existing code or add these lines to the existing code. If you can please send me the full code with the changes made, it’d be very much helpful. I can do it for the week & year calendars.

Thanks,
Prahal

visolveemr wrote on Monday, October 14, 2013:

Hi,
Here is the complete file attached(for the day view) with changes made.

Path to replace the file: interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/ajax_template.html

This will work only for the providers case and not implemented for non-providers case(as we are not sure of your expectation in this scenario).

Thanks
OpenEMR Customization/Support provider,
ViSolve,Inc
services@visolve.com

vprahal wrote on Monday, October 14, 2013:

Hi ViSolve,

Thanks for the reply. It worked for days, but not for week or month. I replaced the ajax_template.html files in the week and month directories with the file provided by you but it doesn’t work. It works for day view. Can you please let me know how to go about it.

Thanks
Prahal

yehster wrote on Monday, October 14, 2013:

The best way to go about implementing it for weeks and months would be to hire Visolve to do the work for you.

OpenEMR is “free” like “free speech” meaning you are allowed to make whatever changes you want.

The bulk of OpenEMR development is done by professionals who need financial support from the community to keep it up.

Visolve has graciously shared significant time and expertise with you at this point, while they may choose to support you further gratis, I hope you consider paying them for their work.

andyflces wrote on Monday, October 21, 2013:

We find this calendar feature helpful as well, so I installed it to our 4.1.1 (14) system. Unfortunately, while the feature is helpful, we could no longer choose from the two separate calendar locations for the clinicians.

Before replacing the ajax_template.html file as instructed, we had renamed the current file by appending it with OLD. Once we realized the feature would not work in the current form, we deleted the ajax_template file again and renamed our previous version to the original file date.

We rebooted our server, but the calendar view did not revert to the original/previous state. The providers continue to see only their own calendar in the DAY view and cannot select from locations. As indicated above, we restored the original file … still, the change did not revert.

Did the modified version posted by ViSolve make another change elsewhere in the system?

Please assist :slight_smile:

Thank you.

Andy

epsdky wrote on Monday, October 21, 2013:

Hello,

Try logging out, shutting down, then clear browser cache (for current day), then restart.

visolveemr wrote on Monday, October 21, 2013:

Hello,

The modifications done above are only intended for the day view of the calendar.

Make sure whether you have done the changes to the correct view (i.e correct folder day/week/month), and also Clear the calendar specific cache(Smarty cache) and try again.

To clear the Smarty Cache go to Administration->Other->Calendar and click Clear Smarty Cache.

Otherwise it can also be done by manually clearing all the entries in the folder /interface/main/calendar/modules/PostCalendar/pntemplates/compiled/

Note: Please Make sure all these folders have necessary permissions.

Thanks
OpenEMR Customization/Support provider,
ViSolve,Inc
services@visolve.com

Not working with openemr 7.0.2