Prepayment ar_session delete sub query always evals to false causing overall query...
[openemr.git] / acl_upgrade.php
blob360b04cf1ec641dd12123c28fd25a678ab4f1bb6
1 <?php
2 /**
3 * Upgrade script for access controls.
5 * This script will update the phpGACL database, which include
6 * Access Control Objects(ACO), Groups(ARO), and Access Control
7 * Lists(ACL) to the most recent version.
8 * It will display whether each update already exist
9 * or if it was updated succesfully.
10 * To avoid reversing customizations, upgrade is done in versions,
11 * which are recorded in the database. To add another version of
12 * changes, use the following template:
13 * <pre>// Upgrade for acl_version <acl_version_here>
14 * $upgrade_acl = <acl_version_here>;
15 * if ($acl_version < $upgrade_acl) {
16 * echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
18 * //Collect the ACL ID numbers.
19 * echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
21 * //Add new object Sections
22 * echo "<BR/><B>Adding new object sections</B><BR/>";
24 * //Add new Objects
25 * echo "<BR/><B>Adding new objects</B><BR/>";
27 * //Update already existing Objects
28 * echo "<BR/><B>Upgrading objects</B><BR/>";
30 * //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
31 * // (will also place in the appropriate group and CREATE a new group if needed)
32 * echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
34 * //Update the ACLs
35 * echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
37 * //DONE with upgrading to this version
38 * $acl_version = $upgrade_acl;
39 * }
40 * </pre>
42 * Updates included:
43 * <pre>---VERSION 1 ACL---
44 * 2.8.2
45 * Section "sensitivities" (Sensitivities):
46 * ADD normal Normal (Administrators, Physicians, Clinicians(addonly))
47 * ADD high High (Administrators, Physicians)
48 * Section "admin" (Administration):
49 * ADD super Superuser (Adminstrators)
50 * 2.8.4
51 * Section "admin" (Administration):
52 * ADD drugs Pharmacy Dispensary (Administrators, Physicians, Clinicians(write))
53 * ADD acl ACL Administration (Administrators)
54 * Section "sensitivities" (Sensitivities):
55 * EDIT high High (ensure the order variable is '20')
56 * Section "acct" (Accounting):
57 * ADD disc Price Discounting (Administrators, Physicians, Accounting(write))
58 * 3.0.2
59 * ADD Section "lists" (Lists):
60 * ADD default Default List (write,addonly optional) (Administrators)
61 * ADD state State List (write,addonly optional) (Administrators)
62 * ADD country Country List (write,addonly optional) (Administrators)
63 * ADD language Language List (write,addonly optional) (Administrators)
64 * ADD ethrace Ethnicity-Race List (write,addonly optional) (Administrators)
65 * ADD Section "placeholder" (Placeholder):
66 * ADD filler Placeholder (Maintains empty ACLs)
67 * ACL/Group doc addonly "Physicians" (filler aco)
68 * ACL/Group front addonly "Front Office" (filler aco)
69 * ACL/Group back addonly "Accounting" (filler aco)
70 * 3.3.0
71 * Section "patients" (Patients):
72 * ADD sign Sign Lab Results (Physicians)
73 * ACL/Group breakglass write "Emergency Login" (added all aco's to it)
74 * 4.1.0
75 * Section "nationnotes" (Nation Notes):
76 * ADD nn_configure Nation Notes Configure (Administrators, Emergency Login)
77 * Section "patientportal" (Patient Portal):
78 * ADD portal Patient Portal (Administrators, Emergency Login)
79 * 4.1.1
80 * ACL/Group doc wsome "Physicians" (filler aco)
81 * ACL/Group clin wsome "Clinicians" (filler aco)
82 * ACL/Group front wsome "Front Office" (filler aco)
83 * ACL/Group back wsome "Accounting" (filler aco)
84 * ACL/Group doc view "Physicians" (filler aco)
85 * ACL/Group clin view "Clinicians" (filler aco)
86 * ACL/Group front view "Front Office" (filler aco)
87 * ACL/Group back view "Accounting" (filler aco)
88 * 4.1.3
89 * Section "menus" (Menus):
90 * ADD modle Module (Administrators, Emergency Login)
91 * 5.0.1
92 * Section "patients" (Patients):
93 * ADD reminder Patient Reminders (Physicians,Clinicians(addonly))
94 * ADD alert Clinical Reminders/Alerts (Physicians,Clinicians,Front Office(view),Accounting(view))
95 * ADD disclosure Disclosures (Physicians,Clinicians(addonly))
96 * ADD rx Prescriptions (Physicians,Clinicians(addonly))
97 * ADD amendment Amendments (Physicians,Clinicians(addonly))
98 * ADD lab Lab Results (Physicians,Clinicians(addonly))
99 * Section "admin" (Administration):
100 * ADD multipledb Multipledb (Administrators)
101 * ADD menu Menu (Administrators)
102 * Section "groups" (Groups):
103 * ADD gadd View/Add/Update groups (Administrators)
104 * ADD gcalendar View/Create/Update groups appointment in calendar (Administrators,Physicians,Clinicians)
105 * ADD glog Group encounter log (Administrators,Physicians, Clinicians)
106 * ADD gdlog Group detailed log of appointment in patient record (Administrators)
107 * ADD gm Send message from the permanent group therapist to the personal therapist (Administrators)
108 * </pre>
110 * @package OpenEMR
111 * @link http://www.open-emr.org
112 * @author Brady Miller <brady.g.miller@gmail.com>
113 * @copyright Copyright (c) 2012-2017 Brady Miller <brady.g.miller@gmail.com>
114 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
117 // Checks if the server's PHP version is compatible with OpenEMR:
118 require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");
120 $response = OpenEMR\Checker::checkPhpVersion();
121 if ($response !== true) {
122 die($response);
125 $ignoreAuth = true; // no login required
127 require_once('interface/globals.php');
128 require_once("$srcdir/acl_upgrade_fx.php");
130 //Ensure that phpGACL has been installed
131 include_once('library/acl.inc');
132 if (isset($phpgacl_location)) {
133 include_once("$phpgacl_location/gacl_api.class.php");
134 $gacl = new gacl_api();
135 } else {
136 die("You must first set up library/acl.inc to use phpGACL!");
139 $acl_version = get_acl_version();
140 if (empty($acl_version)) {
141 $acl_version = 0;
144 // Upgrade for acl_version 1
145 $upgrade_acl = 1;
146 if ($acl_version < $upgrade_acl) {
147 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
149 //Collect the ACL ID numbers.
150 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
151 //Get Administrator ACL ID number
152 $admin_write = getAclIdNumber('Administrators', 'write');
153 //Get Doctor ACL ID Number
154 $doc_write = getAclIdNumber('Physicians', 'write');
155 //Get Clinician ACL with write access ID number
156 $clin_write = getAclIdNumber('Clinicians', 'write');
157 //Get Clinician ACL with addonly access ID number
158 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
159 //Get Receptionist ACL ID number
160 $front_write = getAclIdNumber('Front Office', 'write');
161 //Get Accountant ACL ID number
162 $back_write = getAclIdNumber('Accounting', 'write');
164 //Add new object Sections
165 echo "<BR/><B>Adding new object sections</B><BR/>";
166 //Add 'Sensitivities' object section (added in 2.8.2)
167 addObjectSectionAcl('sensitivities', 'Sensitivities');
168 //Add 'Lists' object section (added in 3.0.2)
169 addObjectSectionAcl('lists', 'Lists');
170 //Add 'Placeholder' object section (added in 3.0.2)
171 addObjectSectionAcl('placeholder', 'Placeholder');
172 //Add 'Nation Notes' object section (added in 4.1.0)
173 addObjectSectionAcl('nationnotes', 'Nation Notes');
174 //Add 'Patient Portal' object section (added in 4.1.0)
175 addObjectSectionAcl('patientportal', 'Patient Portal');
177 //Add new Objects
178 echo "<BR/><B>Adding new objects</B><BR/>";
179 //Add 'Normal' sensitivity object, order variable is default 10 (added in 2.8.2)
180 addObjectAcl('sensitivities', 'Sensitivities', 'normal', 'Normal');
181 //Add 'High' sensitivity object, order variable is set to 20 (added in 2.8.2)
182 addObjectAclWithOrder('sensitivities', 'Sensitivities', 'high', 'High', 20);
183 //Add 'Pharmacy Dispensary' object (added in 2.8.4)
184 addObjectAcl('admin', 'Administration', 'drugs', 'Pharmacy Dispensary');
185 //Add 'ACL Administration' object (added in 2.8.4)
186 addObjectAcl('admin', 'Administration', 'acl', 'ACL Administration');
187 //Add 'Price Discounting' object (added in 2.8.4)
188 addObjectAcl('acct', 'Accounting', 'disc', 'Price Discounting');
189 //Add 'Default List (write,addonly optional)' object (added in 3.0.2)
190 addObjectAcl('lists', 'Lists', 'default', 'Default List (write,addonly optional)');
191 //Add 'State List (write,addonly optional)' object (added in 3.0.2)
192 addObjectAcl('lists', 'Lists', 'state', 'State List (write,addonly optional)');
193 //Add 'Country List (write,addonly optional)' object (added in 3.0.2)
194 addObjectAcl('lists', 'Lists', 'country', 'Country List (write,addonly optional)');
195 //Add 'Language List (write,addonly optional)' object (added in 3.0.2)
196 addObjectAcl('lists', 'Lists', 'language', 'Language List (write,addonly optional)');
197 //Add 'Ethnicity-Race List (write,addonly optional)' object (added in 3.0.2)
198 addObjectAcl('lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)');
199 //Add 'Placeholder (Maintains empty ACLs)' object (added in 3.0.2)
200 addObjectAcl('placeholder', 'Placeholder', 'filler', 'Placeholder (Maintains empty ACLs)');
201 //Add 'Sign Lab Results (write,addonly optional)' object (added in 3.3.0)
202 addObjectAcl('patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)');
203 //Add 'nationnotes' object (added in 4.1.0)
204 addObjectAcl('nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure');
205 //Add 'patientportal' object (added in 4.1.0)
206 addObjectAcl('patientportal', 'Patient Portal', 'portal', 'Patient Portal');
208 //Update already existing Objects
209 echo "<BR/><B>Upgrading objects</B><BR/>";
210 //Ensure that 'High' sensitivity object order variable is set to 20
211 editObjectAcl('sensitivities', 'Sensitivities', 'high', 'High', 20);
213 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
214 // (will also place in the appropriate group and CREATE a new group if needed)
215 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
216 //Add 'Physicians' ACL with 'addonly' and collect the ID number (added in 3.0.2)
217 $doc_addonly = addNewACL('Physicians', 'doc', 'addonly', 'Things that physicians can read and enter but not modify');
218 //Add 'Front Office' ACL with 'addonly' and collect the ID number (added in 3.0.2)
219 $front_addonly = addNewACL('Front Office', 'front', 'addonly', 'Things that front office can read and enter but not modify');
220 //Add 'Accounting' ACL with 'addonly' and collect the ID number (added in 3.0.2)
221 $back_addonly = addNewACL('Accounting', 'back', 'addonly', 'Things that back office can read and enter but not modify');
222 //Add 'Emergency Login' ACL with 'write' and collect the ID number (added in 3.3.0)
223 $emergency_write = addNewACL('Emergency Login', 'breakglass', 'write', 'Things that can use for emergency login, can read and modify');
225 //Update the ACLs
226 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
227 //Insert the 'super' object from the 'admin' section into the Administrators group write ACL (added in 2.8.2)
228 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'super', 'Superuser', 'write');
229 //Insert the 'high' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
230 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
231 //Insert the 'normal' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
232 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
233 //Insert the 'high' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
234 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
235 //Insert the 'normal' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
236 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
237 //Insert the 'normal' object from the 'sensitivities' section into the Clinicians group addonly ACL (added in 2.8.2)
238 updateAcl($clin_addonly, 'Clinicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'addonly');
239 //Insert the 'drugs' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
240 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
241 //Insert the 'drugs' object from the 'admin' section into the Physicians group write ACL (added in 2.8.4)
242 updateAcl($doc_write, 'Physicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
243 //Insert the 'drugs' object from the 'admin' section into the Clinicians group write ACL (added in 2.8.4)
244 updateAcl($clin_write, 'Clinicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
245 //Insert the 'acl' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
246 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
247 //Insert the 'disc' object from the 'acct' section into the Administrators group write ACL (added in 2.8.4)
248 updateAcl($admin_write, 'Administrators', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
249 //Insert the 'disc' object from the 'acct' section into the Accounting group write ACL (added in 2.8.4)
250 updateAcl($back_write, 'Accounting', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
251 //Insert the 'disc' object from the 'acct' section into the Physicians group write ACL (added in 2.8.4)
252 updateAcl($doc_write, 'Physicians', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
253 //Insert the 'default' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
254 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
255 //Insert the 'state' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
256 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
257 //Insert the 'country' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
258 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
259 //Insert the 'language' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
260 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
261 //Insert the 'race' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
262 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
263 //Update ACLs for Emergency Login
264 //Insert the 'disc' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
265 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
266 //Insert the 'bill' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
267 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'bill', 'Billing (write optional)', 'write');
268 //Insert the 'eob' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
269 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'eob', 'EOB Data Entry', 'write');
270 //Insert the 'rep' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
271 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep', 'Financial Reporting - my encounters', 'write');
272 //Insert the 'rep_a' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
273 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep_a', 'Financial Reporting - anything', 'write');
274 //Insert the 'calendar' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
275 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'calendar', 'Calendar Settings', 'write');
276 //Insert the 'database' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
277 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'database', 'Database Reporting', 'write');
278 //Insert the 'forms' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
279 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'forms', 'Forms Administration', 'write');
280 //Insert the 'practice' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
281 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'practice', 'Practice Settings', 'write');
282 //Insert the 'superbill' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
283 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'superbill', 'Superbill Codes Administration', 'write');
284 //Insert the 'users' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
285 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'users', 'Users/Groups/Logs Administration', 'write');
286 //Insert the 'batchcom' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
287 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'batchcom', 'Batch Communication Tool', 'write');
288 //Insert the 'language' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
289 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'language', 'Language Interface Tool', 'write');
290 //Insert the 'super' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
291 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'super', 'Superuser', 'write');
292 //Insert the 'drugs' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
293 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
294 //Insert the 'acl' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
295 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
296 //Insert the 'auth_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
297 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth_a', 'Authorize - any encounters', 'write');
298 //Insert the 'coding_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
299 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding_a', 'Coding - any encounters (write,wsome optional)', 'write');
300 //Insert the 'notes_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
301 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes_a', 'Notes - any encounters (write,addonly optional)', 'write');
302 //Insert the 'date_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
303 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'date_a', 'Fix encounter dates - any encounters', 'write');
304 //Insert the 'default' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
305 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
306 //Insert the 'state' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
307 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
308 //Insert the 'country' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
309 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
310 //Insert the 'language' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
311 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
312 //Insert the 'ethrace' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
313 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
314 //Insert the 'appt' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
315 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'appt', 'Appointments (write,wsome optional)', 'write');
316 //Insert the 'demo' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
317 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'demo', 'Demographics (write,addonly optional)', 'write');
318 //Insert the 'med' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
319 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'med', 'Medical/History (write,addonly optional)', 'write');
320 //Insert the 'trans' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
321 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'write');
322 //Insert the 'docs' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
323 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs', 'Documents (write,addonly optional)', 'write');
324 //Insert the 'notes' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
325 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'notes', 'Patient Notes (write,addonly optional)', 'write');
326 //Insert the 'high' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
327 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
328 //Insert the 'normal' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
329 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
330 //Insert the 'sign' object from the 'patients' section into the Physicians group write ACL (added in 3.3.0)
331 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
332 //Insert the 'sign' object from the 'nationnotes' section into the Administrators group write ACL (added in 3.3.0)
333 updateAcl($admin_write, 'Administrators', 'nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure', 'write');
334 //Insert the 'sign' object from the 'nationnotes' section into the Emergency Login group write ACL (added in 3.3.0)
335 updateAcl($emergency_write, 'Emergency Login', 'nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure', 'write');
336 //Insert the 'patientportal' object from the 'patientportal' section into the Administrators group write ACL (added in 4.1.0)
337 updateAcl($admin_write, 'Administrators', 'patientportal', 'Patient Portal', 'portal', 'Patient Portal', 'write');
338 //Insert the 'patientportal' object from the 'patientportal' section into the Emergency Login group write ACL (added in 4.1.0)
339 updateAcl($emergency_write, 'Emergency Login', 'patientportal', 'Patient Portal', 'portal', 'Patient Portal', 'write');
341 //DONE with upgrading to this version
342 $acl_version = $upgrade_acl;
345 // Upgrade for acl_version 2
346 $upgrade_acl = 2;
347 if ($acl_version < $upgrade_acl) {
348 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
350 //Collect the ACL ID numbers.
351 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
353 //Add new object Sections
354 echo "<BR/><B>Adding new object sections</B><BR/>";
356 //Add new Objects
357 echo "<BR/><B>Adding new objects</B><BR/>";
359 //Update already existing Objects
360 echo "<BR/><B>Upgrading objects</B><BR/>";
362 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
363 // (will also place in the appropriate group and CREATE a new group if needed)
364 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
365 addNewACL('Physicians', 'doc', 'wsome', 'Things that physicians can read and partly modify');
366 addNewACL('Clinicians', 'clin', 'wsome', 'Things that clinicians can read and partly modify');
367 addNewACL('Front Office', 'front', 'wsome', 'Things that front office can read and partly modify');
368 addNewACL('Accounting', 'back', 'wsome', 'Things that back office can read and partly modify');
369 addNewACL('Physicians', 'doc', 'view', 'Things that physicians can only read');
370 addNewACL('Clinicians', 'clin', 'view', 'Things that clinicians can only read');
371 addNewACL('Front Office', 'front', 'view', 'Things that front office can only read');
372 addNewACL('Accounting', 'back', 'view', 'Things that back office can only read');
374 //Update the ACLs
375 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
377 //DONE with upgrading to this version
378 $acl_version = $upgrade_acl;
381 // Upgrade for acl_version 3
382 $upgrade_acl = 3;
383 if ($acl_version < $upgrade_acl) {
384 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
386 //Collect the ACL ID numbers.
387 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
388 //Get Administrator ACL ID number
389 $admin_write = getAclIdNumber('Administrators', 'write');
390 //Get Emergency ACL ID number
391 $emergency_write = getAclIdNumber('Emergency Login', 'write');
393 //Add new object Sections
394 echo "<BR/><B>Adding new object sections</B><BR/>";
395 //Add 'Menus' object section (added in 4.1.3)
396 addObjectSectionAcl('menus', 'Menus');
398 //Add new Objects
399 echo "<BR/><B>Adding new objects</B><BR/>";
400 //Add 'modules' object (added in 4.1.3)
401 addObjectAcl('menus', 'Menus', 'modle', 'Modules');
403 //Update already existing Objects
404 echo "<BR/><B>Upgrading objects</B><BR/>";
406 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
407 // (will also place in the appropriate group and CREATE a new group if needed)
408 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
410 //Update the ACLs
411 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
412 //Insert the 'Modules' object from the 'Menus' section into the Administrators group write ACL (added in 4.1.3)
413 updateAcl($admin_write, 'Administrators', 'menus', 'Menus', 'modle', 'Modules', 'write');
414 //Insert the 'Modules' object from the 'Menus' section into the Emergency Login group write ACL (added in 4.1.3)
415 updateAcl($emergency_write, 'Emergency Login', 'menus', 'Menus', 'modle', 'Modules', 'write');
417 //DONE with upgrading to this version
418 $acl_version = $upgrade_acl;
421 // Upgrade for acl_version 4
422 $upgrade_acl = 4;
423 if ($acl_version < $upgrade_acl) {
424 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
426 //Collect the ACL ID numbers.
427 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
428 //Get Administrator ACL ID number
429 $admin_write = getAclIdNumber('Administrators', 'write');
430 //Get Doctor ACL ID Number
431 $doc_write = getAclIdNumber('Physicians', 'write');
432 //Get Clinician ACL with write access ID number
433 $clin_write = getAclIdNumber('Clinicians', 'write');
434 //Get Clinician ACL with addonly access ID number
435 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
436 //Get Receptionist ACL ID number
437 $front_write = getAclIdNumber('Front Office', 'write');
438 //Get Accountant ACL ID number
439 $back_write = getAclIdNumber('Accounting', 'write');
441 //Add new object Sections
442 // echo "<BR/><B>Adding new object sections</B><BR/>";
444 //Add new Objects
445 echo "<BR/><B>Adding new objects</B><BR/>";
446 // Add 'Patient Reminders (write,addonly optional)' object (added in 5.0.1)
447 addObjectAcl('patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)');
448 // Add 'Clinical Reminders/Alerts (write,addonly optional)' object (added in 5.0.1)
449 addObjectAcl('patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)');
450 // Add 'Disclosures (write,addonly optional)' object (added in 5.0.1)
451 addObjectAcl('patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)');
452 // Add 'Prescriptions (write,addonly optional)' object (added in 5.0.1)
453 addObjectAcl('patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)');
454 // Add 'Amendments (write,addonly optional)' object (added in 5.0.1)
455 addObjectAcl('patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)');
456 // Add 'Lab Results (write,addonly optional)' object (added in 5.0.1)
457 addObjectAcl('patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)');
459 //Update already existing Objects
460 // echo "<BR/><B>Upgrading objects</B><BR/>";
462 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
463 // (will also place in the appropriate group and CREATE a new group if needed)
464 // echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
466 //Update the ACLs
467 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
468 //Insert the 'reminder' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
469 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
470 //Insert the 'alert' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
471 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
472 //Insert the 'disclosure' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
473 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
474 //Insert the 'rx' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
475 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
476 //Insert the 'amendment' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
477 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
478 //Insert the 'lab' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
479 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
480 //DONE with upgrading to this version
481 $acl_version = $upgrade_acl;
484 //This is a template for a new revision, when needed
485 // Upgrade for acl_version 5
486 $upgrade_acl = 5;
487 if ($acl_version < $upgrade_acl) {
488 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
490 //Collect the ACL ID numbers.
491 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
492 //Get Accountant ACL ID number
493 $admin_write = getAclIdNumber('Administrators', 'write');
496 //Add new object Sections
497 echo "<BR/><B>Adding new object sections</B><BR/>";
498 // Add 'Groups' object (added in 5.0.1)
499 addObjectSectionAcl('groups', 'Groups');
502 //Add new Objects
503 echo "<BR/><B>Adding new objects</B><BR/>";
504 // Add 'Multipledb' object (added in 5.0.1)
505 addObjectAcl('admin', 'Administration', 'multipledb', 'Multipledb');
506 addObjectAcl('groups', 'Groups', 'gadd', 'View/Add/Update groups');
507 addObjectAcl('groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar');
508 addObjectAcl('groups', 'Groups', 'glog', 'Group encounter log');
509 addObjectAcl('groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record');
510 addObjectAcl('groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist');
511 //Update already existing Objects
512 echo "<BR/><B>Upgrading objects</B><BR/>";
514 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
515 // (will also place in the appropriate group and CREATE a new group if needed)
516 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
518 //Update the ACLs
519 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
520 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gadd', 'View/Add/Update groups', 'write');
521 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
522 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
523 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record', 'write');
524 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist', 'write');
525 //Insert the 'Multipledb' object from the 'admin' section into the Administrators group write ACL (added in 5.0.1)
526 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'multipledb', 'Multipledb', 'write');
527 //DONE with upgrading to this version
528 $acl_version = $upgrade_acl;
531 // Upgrade for acl_version 6
532 $upgrade_acl = 6;
533 if ($acl_version < $upgrade_acl) {
534 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
536 //Collect the ACL ID numbers.
537 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
538 $admin_write = getAclIdNumber('Administrators', 'write');
539 $doc_write = getAclIdNumber('Physicians', 'write');
540 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
541 $clin_write = getAclIdNumber('Clinicians', 'write');
542 $front_view = getAclIdNumber('Front Office', 'view');
543 $front_write = getAclIdNumber('Front Office', 'write');
544 $back_view = getAclIdNumber('Accounting', 'view');
545 $emergency_write = getAclIdNumber('Emergency Login', 'write');
547 //Add new object Sections
548 echo "<BR/><B>Adding new object sections</B><BR/>";
549 addObjectAcl('admin', 'Administration', 'menu', 'Menu');
551 //Add new Objects
552 echo "<BR/><B>Adding new objects</B><BR/>";
554 //Update already existing Objects
555 echo "<BR/><B>Upgrading objects</B><BR/>";
557 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
558 // (will also place in the appropriate group and CREATE a new group if needed)
559 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
561 //Update the ACLs
562 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
563 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'menu', 'Menu', 'write');
565 updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
566 updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
567 updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
568 updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
570 updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
571 updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
572 updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
573 updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
574 updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
575 updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
576 updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
578 updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
579 updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
580 updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
581 updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
583 updateAcl($doc_write, 'Physicians', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
584 updateAcl($doc_write, 'Physicians', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
586 updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'addonly');
587 updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'addonly');
588 updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'addonly');
589 updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'addonly');
590 updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'addonly');
591 updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'addonly');
592 updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'addonly');
594 updateAcl($clin_write, 'Clinicians', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
595 updateAcl($clin_write, 'Clinicians', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
597 updateAcl($front_view, 'Front Office', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'view');
599 updateAcl($front_write, 'Front Office', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
601 updateAcl($back_view, 'Accounting', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'view');
603 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'multipledb', 'Multipledb', 'write');
604 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'menu', 'Menu', 'write');
605 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
606 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
607 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
608 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
609 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
610 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
611 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
612 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
613 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
614 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
615 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
616 updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gadd', 'View/Add/Update groups', 'write');
617 updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
618 updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
619 updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record', 'write');
620 updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist', 'write');
622 //DONE with upgrading to this version
623 $acl_version = $upgrade_acl;
626 /* This is a template for a new revision, when needed
627 // Upgrade for acl_version 7
628 $upgrade_acl = 7;
629 if ($acl_version < $upgrade_acl) {
630 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
632 //Collect the ACL ID numbers.
633 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
635 //Add new object Sections
636 echo "<BR/><B>Adding new object sections</B><BR/>";
638 //Add new Objects
639 echo "<BR/><B>Adding new objects</B><BR/>";
641 //Update already existing Objects
642 echo "<BR/><B>Upgrading objects</B><BR/>";
644 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
645 // (will also place in the appropriate group and CREATE a new group if needed)
646 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
648 //Update the ACLs
649 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
651 //DONE with upgrading to this version
652 $acl_version = $upgrade_acl;
656 /* This is a template for a new revision, when needed
657 // Upgrade for acl_version 8
658 $upgrade_acl = 8;
659 if ($acl_version < $upgrade_acl) {
660 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
662 //Collect the ACL ID numbers.
663 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
665 //Add new object Sections
666 echo "<BR/><B>Adding new object sections</B><BR/>";
668 //Add new Objects
669 echo "<BR/><B>Adding new objects</B><BR/>";
671 //Update already existing Objects
672 echo "<BR/><B>Upgrading objects</B><BR/>";
674 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
675 // (will also place in the appropriate group and CREATE a new group if needed)
676 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
678 //Update the ACLs
679 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
681 //DONE with upgrading to this version
682 $acl_version = $upgrade_acl;
686 //All done
687 $response = set_acl_version($acl_version);
689 if ($response) {
690 echo "DONE upgrading access controls";
691 } else {
692 echo "ERROR upgrading access control version";