Allows display of appointments in descending order, take 2.
[openemr.git] / acl_setup.php
blobacaaed9ba8e0c29f906192c37da29d9ba4ec466f
1 <?php
2 // Copyright (C) 2005-2006 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is run by the OpenEMR setup.php script to install phpGACL
10 // and creates the Access Control Objects and their sections.
11 // See openemr/library/acl.inc file for the list of
12 // currently supported Access Control Objects(ACO), which this
13 // script will install. This script also creates several
14 // ARO groups, an "admin" ARO, and some reasonable ACL entries for
15 // the groups.
16 // ARO groups include:
17 // Administrators
18 // Physicians (Doctors)
19 // Clinicians (Nurses, Physician Assistants, etc.)
20 // Front Office (Receptionist)
21 // Accounting
23 // Upgrade Howto
24 // When upgrading to a new version of OpenEMR, run the acl_upgrade.php
25 // script to update the phpGACL access controls. This is required to
26 // ensure the database includes all the required Access Control
27 // Objects(ACO).
30 // On 06/2009, added pertinent comments below each entry to allow capture
31 // of these terms by the translation engine.
33 require_once(dirname(__FILE__).'/library/acl.inc');
35 if (! $phpgacl_location) die("You must first set up library/acl.inc to use phpGACL!");
37 require_once("$phpgacl_location/gacl_api.class.php");
39 $gacl = new gacl_api();
41 // Create the ACO sections. Every ACO must have a section.
43 if ($gacl->add_object_section('Accounting', 'acct', 10, 0, 'ACO') === FALSE) {
44 echo "Unable to create the access controls for OpenEMR. You have likely already run this script (acl_setup.php) successfully.<br>Other possible problems include php-GACL configuration file errors (gacl.ini.php or gacl.class.php).<br>";
45 return;
47 // xl('Accounting')
48 $gacl->add_object_section('Administration', 'admin' , 10, 0, 'ACO');
49 // xl('Administration')
50 $gacl->add_object_section('Encounters' , 'encounters' , 10, 0, 'ACO');
51 // xl('Encounters')
52 $gacl->add_object_section('Lists' , 'lists' , 10, 0, 'ACO');
53 // xl('Lists')
54 $gacl->add_object_section('Patients' , 'patients' , 10, 0, 'ACO');
55 // xl('Patients')
56 $gacl->add_object_section('Squads' , 'squads' , 10, 0, 'ACO');
57 // xl('Squads')
58 $gacl->add_object_section('Sensitivities' , 'sensitivities', 10, 0, 'ACO');
59 // xl('Sensitivities')
60 $gacl->add_object_section('Placeholder' , 'placeholder' , 10, 0, 'ACO');
61 // xl('Placeholder')
62 $gacl->add_object_section('Nation Notes' , 'nationnotes' , 10, 0, 'ACO');
63 // xl('Nation Notes')
64 $gacl->add_object_section('Patient Portal','patientportal' , 10, 0, 'ACO');
65 // xl('Patient Portal')
66 $gacl->add_object_section('Menus','menus' , 10, 0, 'ACO');
67 // xl('Menus')
68 // Create Accounting ACOs.
70 $gacl->add_object('acct', 'Billing (write optional)' , 'bill' , 10, 0, 'ACO');
71 // xl('Billing (write optional)')
72 $gacl->add_object('acct', 'Price Discounting' , 'disc' , 10, 0, 'ACO');
73 // xl('Price Discounting')
74 $gacl->add_object('acct', 'EOB Data Entry' , 'eob' , 10, 0, 'ACO');
75 // xl('EOB Data Entry')
76 $gacl->add_object('acct', 'Financial Reporting - my encounters', 'rep' , 10, 0, 'ACO');
77 // xl('Financial Reporting - my encounters')
78 $gacl->add_object('acct', 'Financial Reporting - anything' , 'rep_a', 10, 0, 'ACO');
79 // xl('Financial Reporting - anything')
81 // Create Administration ACOs.
83 $gacl->add_object('admin', 'Superuser' , 'super' , 10, 0, 'ACO');
84 // xl('Superuser')
85 $gacl->add_object('admin', 'Calendar Settings' , 'calendar' , 10, 0, 'ACO');
86 // xl('Calendar Settings')
87 $gacl->add_object('admin', 'Database Reporting' , 'database' , 10, 0, 'ACO');
88 // xl('Database Reporting')
89 $gacl->add_object('admin', 'Forms Administration' , 'forms' , 10, 0, 'ACO');
90 // xl('Forms Administration')
91 $gacl->add_object('admin', 'Practice Settings' , 'practice' , 10, 0, 'ACO');
92 // xl('Practice Settings')
93 $gacl->add_object('admin', 'Superbill Codes Administration' , 'superbill', 10, 0, 'ACO');
94 // xl('Superbill Codes Administration')
95 $gacl->add_object('admin', 'Users/Groups/Logs Administration', 'users' , 10, 0, 'ACO');
96 // xl('Users/Groups/Logs Administration')
97 $gacl->add_object('admin', 'Batch Communication Tool' , 'batchcom' , 10, 0, 'ACO');
98 // xl('Batch Communication Tool')
99 $gacl->add_object('admin', 'Language Interface Tool' , 'language' , 10, 0, 'ACO');
100 // xl('Language Interface Tool')
101 $gacl->add_object('admin', 'Pharmacy Dispensary' , 'drugs' , 10, 0, 'ACO');
102 // xl('Pharmacy Dispensary')
103 $gacl->add_object('admin', 'ACL Administration' , 'acl' , 10, 0, 'ACO');
104 // xl('ACL Administration')
106 // Create ACOs for encounters.
108 $gacl->add_object('encounters', 'Authorize - my encounters' , 'auth' , 10, 0, 'ACO');
109 // xl('Authorize - my encounters')
110 $gacl->add_object('encounters', 'Authorize - any encounters' , 'auth_a' , 10, 0, 'ACO');
111 // xl('Authorize - any encounters')
112 $gacl->add_object('encounters', 'Coding - my encounters (write,wsome optional)' , 'coding' , 10, 0, 'ACO');
113 // xl('Coding - my encounters (write,wsome optional)')
114 $gacl->add_object('encounters', 'Coding - any encounters (write,wsome optional)' , 'coding_a', 10, 0, 'ACO');
115 // xl('Coding - any encounters (write,wsome optional)')
116 $gacl->add_object('encounters', 'Notes - my encounters (write,addonly optional)' , 'notes' , 10, 0, 'ACO');
117 // xl('Notes - my encounters (write,addonly optional)')
118 $gacl->add_object('encounters', 'Notes - any encounters (write,addonly optional)' , 'notes_a' , 10, 0, 'ACO');
119 // xl('Notes - any encounters (write,addonly optional)')
120 $gacl->add_object('encounters', 'Fix encounter dates - any encounters' , 'date_a' , 10, 0, 'ACO');
121 // xl('Fix encounter dates - any encounters')
122 $gacl->add_object('encounters', 'Less-private information (write,addonly optional)', 'relaxed' , 10, 0, 'ACO');
123 // xl('Less-private information (write,addonly optional)')
125 // Create ACOs for lists.
127 $gacl->add_object('lists', 'Default List (write,addonly optional)' , 'default' , 10, 0, 'ACO');
128 // xl('Default List (write,addonly optional)')
129 $gacl->add_object('lists', 'State List (write,addonly optional)' , 'state' , 10, 0, 'ACO');
130 // xl('State List (write,addonly optional)')
131 $gacl->add_object('lists', 'Country List (write,addonly optional)' , 'country' , 10, 0, 'ACO');
132 // xl('Country List (write,addonly optional)')
133 $gacl->add_object('lists', 'Language List (write,addonly optional)' , 'language' , 10, 0, 'ACO');
134 // xl('Language List (write,addonly optional)')
135 $gacl->add_object('lists', 'Ethnicity-Race List (write,addonly optional)' , 'ethrace' , 10, 0, 'ACO');
136 // xl('Ethnicity-Race List (write,addonly optional)')
138 // Create ACOs for patientportal.
140 $gacl->add_object('patientportal', 'Patient Portal' , 'portal' , 10, 0, 'ACO');
141 // xl('Patient Portal')
143 // Create ACOs for modules.
145 $gacl->add_object('menus', 'Modules' , 'modle' , 10, 0, 'ACO');
146 // xl('Modules')
148 // Create ACOs for patients.
150 $gacl->add_object('patients', 'Appointments (write,wsome optional)' , 'appt' , 10, 0, 'ACO');
151 // xl('Appointments (write,wsome optional)')
152 $gacl->add_object('patients', 'Demographics (write,addonly optional)' , 'demo' , 10, 0, 'ACO');
153 // xl('Demographics (write,addonly optional)')
154 $gacl->add_object('patients', 'Medical/History (write,addonly optional)' , 'med' , 10, 0, 'ACO');
155 // xl('Medical/History (write,addonly optional)')
156 $gacl->add_object('patients', 'Transactions (write optional)' , 'trans', 10, 0, 'ACO');
157 // xl('Transactions (write optional)')
158 $gacl->add_object('patients', 'Documents (write,addonly optional)' , 'docs' , 10, 0, 'ACO');
159 // xl('Documents (write,addonly optional)')
160 $gacl->add_object('patients', 'Patient Notes (write,addonly optional)' , 'notes', 10, 0, 'ACO');
161 // xl('Patient Notes (write,addonly optional)')
162 $gacl->add_object('patients', 'Sign Lab Results (write,addonly optional)', 'sign' , 10, 0, 'ACO');
163 // xl('Sign Lab Results (write,addonly optional)')
165 // Create ACOs for sensitivities.
167 $gacl->add_object('sensitivities', 'Normal', 'normal', 10, 0, 'ACO');
168 // xl('Normal')
169 $gacl->add_object('sensitivities', 'High' , 'high' , 20, 0, 'ACO');
170 // xl('High')
172 // Create ACO for placeholder.
174 $gacl->add_object('placeholder', 'Placeholder (Maintains empty ACLs)', 'filler', 10, 0, 'ACO');
175 // xl('Placeholder (Maintains empty ACLs)')
177 // Create ACO for nationnotes.
179 $gacl->add_object('nationnotes', 'Nation Notes Configure', 'nn_configure', 10, 0, 'ACO');
180 // xl('Nation Notes Configure')
182 // Create ARO groups.
184 $users = $gacl->add_group('users', 'OpenEMR Users' , 0 , 'ARO');
185 // xl('OpenEMR Users')
186 $admin = $gacl->add_group('admin', 'Administrators', $users, 'ARO');
187 // xl('Administrators')
188 $clin = $gacl->add_group('clin' , 'Clinicians' , $users, 'ARO');
189 // xl('Clinicians')
190 $doc = $gacl->add_group('doc' , 'Physicians' , $users, 'ARO');
191 // xl('Physicians')
192 $front = $gacl->add_group('front', 'Front Office' , $users, 'ARO');
193 // xl('Front Office')
194 $back = $gacl->add_group('back' , 'Accounting' , $users, 'ARO');
195 // xl('Accounting')
196 $breakglass = $gacl->add_group('breakglass' , 'Emergency Login' , $users, 'ARO');
197 // xl('Emergency Login')
200 // Create a Users section for the AROs (humans).
202 $gacl->add_object_section('Users', 'users', 10, 0, 'ARO');
203 // xl('Users')
205 // Create the Administrator in the above-created "users" section
206 // and add him/her to the above-created "admin" group.
207 // If this script is being used by OpenEMR's setup, then will
208 // incorporate the installation values. Otherwise will
209 // hardcode the 'admin' user.
210 if ( isset($this->iuser) ) {
211 $gacl->add_object('users', $this->iuname, $this->iuser, 10, 0, 'ARO');
212 $gacl->add_group_object($admin, 'users', $this->iuser, 'ARO');
214 else {
215 $gacl->add_object('users', 'Administrator', 'admin' ,10, 0, 'ARO');
216 $gacl->add_group_object($admin, 'users', 'admin', 'ARO');
219 // Declare return terms for language translations
220 // xl('write') xl('wsome') xl('addonly') xl('view')
222 // Set permissions for administrators.
224 $gacl->add_acl(
225 array(
226 'acct'=>array('bill', 'disc', 'eob', 'rep', 'rep_a'),
227 'admin'=>array('calendar', 'database', 'forms', 'practice', 'superbill', 'users', 'batchcom', 'language', 'super', 'drugs', 'acl'),
228 'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
229 'lists'=>array('default','state','country','language','ethrace'),
230 'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes'),
231 'sensitivities'=>array('normal', 'high'),
232 'nationnotes'=>array('nn_configure'),
233 'patientportal'=>array('portal'),
234 'menus'=>array('modle')
236 NULL, array($admin), NULL, NULL,
237 1, 1, 'write', 'Administrators can do anything'
239 // xl('Administrators can do anything')
241 // Set permissions for physicians.
243 $gacl->add_acl(
244 array(
245 'placeholder'=>array('filler')
247 NULL, array($doc), NULL, NULL,
248 1, 1, 'view', 'Things that physicians can only read'
250 // xl('Things that physicians can only read')
251 $gacl->add_acl(
252 array(
253 'placeholder'=>array('filler')
255 NULL, array($doc), NULL, NULL,
256 1, 1, 'addonly', 'Things that physicians can read and enter but not modify'
258 // xl('Things that physicians can read and enter but not modify')
259 $gacl->add_acl(
260 array(
261 'placeholder'=>array('filler')
263 NULL, array($doc), NULL, NULL,
264 1, 1, 'wsome', 'Things that physicians can read and partly modify'
266 // xl('Things that physicians can read and partly modify')
267 $gacl->add_acl(
268 array(
269 'acct'=>array('disc', 'rep'),
270 'admin'=>array('drugs'),
271 'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
272 'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes', 'sign'),
273 'sensitivities'=>array('normal', 'high')
275 NULL, array($doc), NULL, NULL,
276 1, 1, 'write', 'Things that physicians can read and modify'
278 // xl('Things that physicians can read and modify')
280 // Set permissions for clinicians.
282 $gacl->add_acl(
283 array(
284 'placeholder'=>array('filler')
286 NULL, array($clin), NULL, NULL,
287 1, 1, 'view', 'Things that clinicians can only read'
289 // xl('Things that clinicians can only read')
290 $gacl->add_acl(
291 array(
292 'encounters'=>array('notes', 'relaxed'),
293 'patients'=>array('demo', 'med', 'docs', 'notes'),
294 'sensitivities'=>array('normal')
296 NULL, array($clin), NULL, NULL,
297 1, 1, 'addonly', 'Things that clinicians can read and enter but not modify'
299 // xl('Things that clinicians can read and enter but not modify')
301 $gacl->add_acl(
302 array(
303 'placeholder'=>array('filler')
305 NULL, array($clin), NULL, NULL,
306 1, 1, 'wsome', 'Things that clinicians can read and partly modify'
308 // xl('Things that clinicians can read and partly modify')
309 $gacl->add_acl(
310 array(
311 'admin'=>array('drugs'),
312 'encounters'=>array('coding'),
313 'patients'=>array('appt')
315 NULL, array($clin), NULL, NULL,
316 1, 1, 'write', 'Things that clinicians can read and modify'
318 // xl('Things that clinicians can read and modify')
320 // Set permissions for front office staff.
322 $gacl->add_acl(
323 array(
324 'placeholder'=>array('filler')
326 NULL, array($front), NULL, NULL,
327 1, 1, 'view', 'Things that front office can only read'
329 // xl('Things that front office can only read')
330 $gacl->add_acl(
331 array(
332 'placeholder'=>array('filler')
334 NULL, array($front), NULL, NULL,
335 1, 1, 'addonly', 'Things that front office can read and enter but not modify'
337 // xl('Things that front office can read and enter but not modify')
338 $gacl->add_acl(
339 array(
340 'placeholder'=>array('filler')
342 NULL, array($front), NULL, NULL,
343 1, 1, 'wsome', 'Things that front office can read and partly modify'
345 // xl('Things that front office can read and partly modify')
346 $gacl->add_acl(
347 array(
348 'patients'=>array('appt', 'demo', 'trans', 'notes')
350 NULL, array($front), NULL, NULL,
351 1, 1, 'write', 'Things that front office can read and modify'
353 // xl('Things that front office can read and modify')
355 // Set permissions for back office staff.
357 $gacl->add_acl(
358 array(
359 'placeholder'=>array('filler')
361 NULL, array($back), NULL, NULL,
362 1, 1, 'view', 'Things that back office can only read'
364 // xl('Things that back office can only read')
365 $gacl->add_acl(
366 array(
367 'placeholder'=>array('filler')
369 NULL, array($back), NULL, NULL,
370 1, 1, 'addonly', 'Things that back office can read and enter but not modify'
372 // xl('Things that back office can read and enter but not modify')
373 $gacl->add_acl(
374 array(
375 'placeholder'=>array('filler')
377 NULL, array($back), NULL, NULL,
378 1, 1, 'wsome', 'Things that back office can read and partly modify'
380 // xl('Things that back office can read and partly modify')
381 $gacl->add_acl(
382 array(
383 'acct'=>array('bill', 'disc', 'eob', 'rep', 'rep_a'),
384 'admin'=>array('practice', 'superbill'),
385 'encounters'=>array('auth_a', 'coding_a', 'date_a'),
386 'patients'=>array('appt', 'demo')
388 NULL, array($back), NULL, NULL,
389 1, 1, 'write', 'Things that back office can read and modify'
391 // xl('Things that back office can read and modify')
393 // Set permissions for Emergency Login.
395 $gacl->add_acl(
396 array(
397 'acct'=>array('bill', 'disc', 'eob', 'rep', 'rep_a'),
398 'admin'=>array('calendar', 'database', 'forms', 'practice', 'superbill', 'users', 'batchcom', 'language', 'super', 'drugs', 'acl'),
399 'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
400 'lists'=>array('default','state','country','language','ethrace'),
401 'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes'),
402 'sensitivities'=>array('normal', 'high'),
403 'nationnotes'=>array('nn_configure'),
404 'patientportal'=>array('portal'),
405 'menus'=>array('modle')
407 NULL, array($breakglass), NULL, NULL,
408 1, 1, 'write', 'Emergency Login user can do anything'
410 // xl('Emergency Login user can do anything')
413 <html>
414 <head>
415 <title>OpenEMR ACL Setup</title>
416 <link rel=STYLESHEET href="interface/themes/style_blue.css">
417 </head>
418 <body>
419 <b>OpenEMR ACL Setup</b>
420 <br>
421 All done configuring and installing access controls (php-GACL)!
422 </body>
423 </html>