Merge pull request #959 for fix in vitals form and encounter
[openemr.git] / acl_upgrade.php
blob1b87334c4f5ec4e632abc3b5246f73b0522d8a1f
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)
94 * ADD alert Clinical Reminders/Alerts (Physicians)
95 * ADD disclosure Disclosures (Physicians)
96 * ADD rx Prescriptions (Physicians)
97 * ADD amendment Amendments (Physicians)
98 * ADD lab Lab Results (Physicians)
99 * Section "admin" (Administration):
100 * ADD multipledb Multipledb (Administrators)
101 * Section "groups" (Groups):
102 * ADD gadd View/Add/Update groups (Administrators)
103 * ADD gcalendar View/Create/Update groups appointment in calendar (Administrators)
104 * ADD glog Group encounter log (Administrators)
105 * ADD gdlog Group detailed log of appointment in patient record (Administrators)
106 * ADD gm Send message from the permanent group therapist to the personal therapist (Administrators)
107 * </pre>
109 * Copyright (C) 2012 Brady Miller <brady.g.miller@gmail.com>
111 * LICENSE: This program is free software; you can redistribute it and/or
112 * modify it under the terms of the GNU General Public License
113 * as published by the Free Software Foundation; either version 2
114 * of the License, or (at your option) any later version.
115 * This program is distributed in the hope that it will be useful,
116 * but WITHOUT ANY WARRANTY; without even the implied warranty of
117 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
118 * GNU General Public License for more details.
119 * You should have received a copy of the GNU General Public License
120 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
122 * @package OpenEMR
123 * @author Brady Miller <brady.g.miller@gmail.com>
124 * @link http://www.open-emr.org
127 // Checks if the server's PHP version is compatible with OpenEMR:
128 require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");
130 $response = OpenEMR\Checker::checkPhpVersion();
131 if ($response !== true) {
132 die($response);
135 $ignoreAuth = true; // no login required
137 require_once('interface/globals.php');
138 require_once("$srcdir/acl_upgrade_fx.php");
140 //Ensure that phpGACL has been installed
141 include_once('library/acl.inc');
142 if (isset($phpgacl_location)) {
143 include_once("$phpgacl_location/gacl_api.class.php");
144 $gacl = new gacl_api();
145 } else {
146 die("You must first set up library/acl.inc to use phpGACL!");
149 $acl_version = get_acl_version();
150 if (empty($acl_version)) {
151 $acl_version = 0;
154 // Upgrade for acl_version 1
155 $upgrade_acl = 1;
156 if ($acl_version < $upgrade_acl) {
157 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
159 //Collect the ACL ID numbers.
160 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
161 //Get Administrator ACL ID number
162 $admin_write = getAclIdNumber('Administrators', 'write');
163 //Get Doctor ACL ID Number
164 $doc_write = getAclIdNumber('Physicians', 'write');
165 //Get Clinician ACL with write access ID number
166 $clin_write = getAclIdNumber('Clinicians', 'write');
167 //Get Clinician ACL with addonly access ID number
168 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
169 //Get Receptionist ACL ID number
170 $front_write = getAclIdNumber('Front Office', 'write');
171 //Get Accountant ACL ID number
172 $back_write = getAclIdNumber('Accounting', 'write');
174 //Add new object Sections
175 echo "<BR/><B>Adding new object sections</B><BR/>";
176 //Add 'Sensitivities' object section (added in 2.8.2)
177 addObjectSectionAcl('sensitivities', 'Sensitivities');
178 //Add 'Lists' object section (added in 3.0.2)
179 addObjectSectionAcl('lists', 'Lists');
180 //Add 'Placeholder' object section (added in 3.0.2)
181 addObjectSectionAcl('placeholder', 'Placeholder');
182 //Add 'Nation Notes' object section (added in 4.1.0)
183 addObjectSectionAcl('nationnotes', 'Nation Notes');
184 //Add 'Patient Portal' object section (added in 4.1.0)
185 addObjectSectionAcl('patientportal', 'Patient Portal');
187 //Add new Objects
188 echo "<BR/><B>Adding new objects</B><BR/>";
189 //Add 'Normal' sensitivity object, order variable is default 10 (added in 2.8.2)
190 addObjectAcl('sensitivities', 'Sensitivities', 'normal', 'Normal');
191 //Add 'High' sensitivity object, order variable is set to 20 (added in 2.8.2)
192 addObjectAclWithOrder('sensitivities', 'Sensitivities', 'high', 'High', 20);
193 //Add 'Pharmacy Dispensary' object (added in 2.8.4)
194 addObjectAcl('admin', 'Administration', 'drugs', 'Pharmacy Dispensary');
195 //Add 'ACL Administration' object (added in 2.8.4)
196 addObjectAcl('admin', 'Administration', 'acl', 'ACL Administration');
197 //Add 'Price Discounting' object (added in 2.8.4)
198 addObjectAcl('acct', 'Accounting', 'disc', 'Price Discounting');
199 //Add 'Default List (write,addonly optional)' object (added in 3.0.2)
200 addObjectAcl('lists', 'Lists', 'default', 'Default List (write,addonly optional)');
201 //Add 'State List (write,addonly optional)' object (added in 3.0.2)
202 addObjectAcl('lists', 'Lists', 'state', 'State List (write,addonly optional)');
203 //Add 'Country List (write,addonly optional)' object (added in 3.0.2)
204 addObjectAcl('lists', 'Lists', 'country', 'Country List (write,addonly optional)');
205 //Add 'Language List (write,addonly optional)' object (added in 3.0.2)
206 addObjectAcl('lists', 'Lists', 'language', 'Language List (write,addonly optional)');
207 //Add 'Ethnicity-Race List (write,addonly optional)' object (added in 3.0.2)
208 addObjectAcl('lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)');
209 //Add 'Placeholder (Maintains empty ACLs)' object (added in 3.0.2)
210 addObjectAcl('placeholder', 'Placeholder', 'filler', 'Placeholder (Maintains empty ACLs)');
211 //Add 'Sign Lab Results (write,addonly optional)' object (added in 3.3.0)
212 addObjectAcl('patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)');
213 //Add 'nationnotes' object (added in 4.1.0)
214 addObjectAcl('nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure');
215 //Add 'patientportal' object (added in 4.1.0)
216 addObjectAcl('patientportal', 'Patient Portal', 'portal', 'Patient Portal');
218 //Update already existing Objects
219 echo "<BR/><B>Upgrading objects</B><BR/>";
220 //Ensure that 'High' sensitivity object order variable is set to 20
221 editObjectAcl('sensitivities', 'Sensitivities', 'high', 'High', 20);
223 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
224 // (will also place in the appropriate group and CREATE a new group if needed)
225 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
226 //Add 'Physicians' ACL with 'addonly' and collect the ID number (added in 3.0.2)
227 $doc_addonly = addNewACL('Physicians', 'doc', 'addonly', 'Things that physicians can read and enter but not modify');
228 //Add 'Front Office' ACL with 'addonly' and collect the ID number (added in 3.0.2)
229 $front_addonly = addNewACL('Front Office', 'front', 'addonly', 'Things that front office can read and enter but not modify');
230 //Add 'Accounting' ACL with 'addonly' and collect the ID number (added in 3.0.2)
231 $back_addonly = addNewACL('Accounting', 'back', 'addonly', 'Things that back office can read and enter but not modify');
232 //Add 'Emergency Login' ACL with 'write' and collect the ID number (added in 3.3.0)
233 $emergency_write = addNewACL('Emergency Login', 'breakglass', 'write', 'Things that can use for emergency login, can read and modify');
235 //Update the ACLs
236 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
237 //Insert the 'super' object from the 'admin' section into the Administrators group write ACL (added in 2.8.2)
238 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'super', 'Superuser', 'write');
239 //Insert the 'high' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
240 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
241 //Insert the 'normal' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
242 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
243 //Insert the 'high' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
244 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
245 //Insert the 'normal' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
246 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
247 //Insert the 'normal' object from the 'sensitivities' section into the Clinicians group addonly ACL (added in 2.8.2)
248 updateAcl($clin_addonly, 'Clinicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'addonly');
249 //Insert the 'drugs' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
250 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
251 //Insert the 'drugs' object from the 'admin' section into the Physicians group write ACL (added in 2.8.4)
252 updateAcl($doc_write, 'Physicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
253 //Insert the 'drugs' object from the 'admin' section into the Clinicians group write ACL (added in 2.8.4)
254 updateAcl($clin_write, 'Clinicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
255 //Insert the 'acl' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
256 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
257 //Insert the 'disc' object from the 'acct' section into the Administrators group write ACL (added in 2.8.4)
258 updateAcl($admin_write, 'Administrators', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
259 //Insert the 'disc' object from the 'acct' section into the Accounting group write ACL (added in 2.8.4)
260 updateAcl($back_write, 'Accounting', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
261 //Insert the 'disc' object from the 'acct' section into the Physicians group write ACL (added in 2.8.4)
262 updateAcl($doc_write, 'Physicians', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
263 //Insert the 'default' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
264 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
265 //Insert the 'state' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
266 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
267 //Insert the 'country' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
268 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
269 //Insert the 'language' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
270 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
271 //Insert the 'race' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
272 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
273 //Update ACLs for Emergency Login
274 //Insert the 'disc' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
275 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
276 //Insert the 'bill' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
277 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'bill', 'Billing (write optional)', 'write');
278 //Insert the 'eob' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
279 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'eob', 'EOB Data Entry', 'write');
280 //Insert the 'rep' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
281 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep', 'Financial Reporting - my encounters', 'write');
282 //Insert the 'rep_a' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
283 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep_a', 'Financial Reporting - anything', 'write');
284 //Insert the 'calendar' 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', 'calendar', 'Calendar Settings', 'write');
286 //Insert the 'database' 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', 'database', 'Database Reporting', 'write');
288 //Insert the 'forms' 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', 'forms', 'Forms Administration', 'write');
290 //Insert the 'practice' 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', 'practice', 'Practice Settings', 'write');
292 //Insert the 'superbill' 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', 'superbill', 'Superbill Codes Administration', 'write');
294 //Insert the 'users' 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', 'users', 'Users/Groups/Logs Administration', 'write');
296 //Insert the 'batchcom' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
297 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'batchcom', 'Batch Communication Tool', 'write');
298 //Insert the 'language' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
299 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'language', 'Language Interface Tool', 'write');
300 //Insert the 'super' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
301 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'super', 'Superuser', 'write');
302 //Insert the 'drugs' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
303 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
304 //Insert the 'acl' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
305 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
306 //Insert the 'auth_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
307 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth_a', 'Authorize - any encounters', 'write');
308 //Insert the 'coding_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
309 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding_a', 'Coding - any encounters (write,wsome optional)', 'write');
310 //Insert the 'notes_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
311 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes_a', 'Notes - any encounters (write,addonly optional)', 'write');
312 //Insert the 'date_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
313 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'date_a', 'Fix encounter dates - any encounters', 'write');
314 //Insert the 'default' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
315 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
316 //Insert the 'state' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
317 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
318 //Insert the 'country' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
319 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
320 //Insert the 'language' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
321 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
322 //Insert the 'ethrace' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
323 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
324 //Insert the 'appt' 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', 'appt', 'Appointments (write,wsome optional)', 'write');
326 //Insert the 'demo' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
327 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'demo', 'Demographics (write,addonly optional)', 'write');
328 //Insert the 'med' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
329 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'med', 'Medical/History (write,addonly optional)', 'write');
330 //Insert the 'trans' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
331 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'write');
332 //Insert the 'docs' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
333 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs', 'Documents (write,addonly optional)', 'write');
334 //Insert the 'notes' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
335 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'notes', 'Patient Notes (write,addonly optional)', 'write');
336 //Insert the 'high' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
337 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
338 //Insert the 'normal' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
339 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
340 //Insert the 'sign' object from the 'patients' section into the Physicians group write ACL (added in 3.3.0)
341 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
342 //Insert the 'sign' object from the 'nationnotes' section into the Administrators group write ACL (added in 3.3.0)
343 updateAcl($admin_write, 'Administrators', 'nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure', 'write');
344 //Insert the 'sign' object from the 'nationnotes' section into the Emergency Login group write ACL (added in 3.3.0)
345 updateAcl($emergency_write, 'Emergency Login', 'nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure', 'write');
346 //Insert the 'patientportal' object from the 'patientportal' section into the Administrators group write ACL (added in 4.1.0)
347 updateAcl($admin_write, 'Administrators', 'patientportal', 'Patient Portal', 'portal', 'Patient Portal', 'write');
348 //Insert the 'patientportal' object from the 'patientportal' section into the Emergency Login group write ACL (added in 4.1.0)
349 updateAcl($emergency_write, 'Emergency Login', 'patientportal', 'Patient Portal', 'portal', 'Patient Portal', 'write');
351 //DONE with upgrading to this version
352 $acl_version = $upgrade_acl;
355 // Upgrade for acl_version 2
356 $upgrade_acl = 2;
357 if ($acl_version < $upgrade_acl) {
358 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
360 //Collect the ACL ID numbers.
361 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
363 //Add new object Sections
364 echo "<BR/><B>Adding new object sections</B><BR/>";
366 //Add new Objects
367 echo "<BR/><B>Adding new objects</B><BR/>";
369 //Update already existing Objects
370 echo "<BR/><B>Upgrading objects</B><BR/>";
372 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
373 // (will also place in the appropriate group and CREATE a new group if needed)
374 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
375 addNewACL('Physicians', 'doc', 'wsome', 'Things that physicians can read and partly modify');
376 addNewACL('Clinicians', 'clin', 'wsome', 'Things that clinicians can read and partly modify');
377 addNewACL('Front Office', 'front', 'wsome', 'Things that front office can read and partly modify');
378 addNewACL('Accounting', 'back', 'wsome', 'Things that back office can read and partly modify');
379 addNewACL('Physicians', 'doc', 'view', 'Things that physicians can only read');
380 addNewACL('Clinicians', 'clin', 'view', 'Things that clinicians can only read');
381 addNewACL('Front Office', 'front', 'view', 'Things that front office can only read');
382 addNewACL('Accounting', 'back', 'view', 'Things that back office can only read');
384 //Update the ACLs
385 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
387 //DONE with upgrading to this version
388 $acl_version = $upgrade_acl;
391 // Upgrade for acl_version 3
392 $upgrade_acl = 3;
393 if ($acl_version < $upgrade_acl) {
394 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
396 //Collect the ACL ID numbers.
397 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
398 //Get Administrator ACL ID number
399 $admin_write = getAclIdNumber('Administrators', 'write');
400 //Get Emergency ACL ID number
401 $emergency_write = getAclIdNumber('Emergency Login', 'write');
403 //Add new object Sections
404 echo "<BR/><B>Adding new object sections</B><BR/>";
405 //Add 'Menus' object section (added in 4.1.3)
406 addObjectSectionAcl('menus', 'Menus');
408 //Add new Objects
409 echo "<BR/><B>Adding new objects</B><BR/>";
410 //Add 'modules' object (added in 4.1.3)
411 addObjectAcl('menus', 'Menus', 'modle', 'Modules');
413 //Update already existing Objects
414 echo "<BR/><B>Upgrading objects</B><BR/>";
416 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
417 // (will also place in the appropriate group and CREATE a new group if needed)
418 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
420 //Update the ACLs
421 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
422 //Insert the 'Modules' object from the 'Menus' section into the Administrators group write ACL (added in 4.1.3)
423 updateAcl($admin_write, 'Administrators', 'menus', 'Menus', 'modle', 'Modules', 'write');
424 //Insert the 'Modules' object from the 'Menus' section into the Emergency Login group write ACL (added in 4.1.3)
425 updateAcl($emergency_write, 'Emergency Login', 'menus', 'Menus', 'modle', 'Modules', 'write');
427 //DONE with upgrading to this version
428 $acl_version = $upgrade_acl;
431 // Upgrade for acl_version 4
432 $upgrade_acl = 4;
433 if ($acl_version < $upgrade_acl) {
434 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
436 //Collect the ACL ID numbers.
437 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
438 //Get Administrator ACL ID number
439 $admin_write = getAclIdNumber('Administrators', 'write');
440 //Get Doctor ACL ID Number
441 $doc_write = getAclIdNumber('Physicians', 'write');
442 //Get Clinician ACL with write access ID number
443 $clin_write = getAclIdNumber('Clinicians', 'write');
444 //Get Clinician ACL with addonly access ID number
445 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
446 //Get Receptionist ACL ID number
447 $front_write = getAclIdNumber('Front Office', 'write');
448 //Get Accountant ACL ID number
449 $back_write = getAclIdNumber('Accounting', 'write');
451 //Add new object Sections
452 // echo "<BR/><B>Adding new object sections</B><BR/>";
454 //Add new Objects
455 echo "<BR/><B>Adding new objects</B><BR/>";
456 // Add 'Patient Reminders (write,addonly optional)' object (added in 5.0.1)
457 addObjectAcl('patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)');
458 // Add 'Clinical Reminders/Alerts (write,addonly optional)' object (added in 5.0.1)
459 addObjectAcl('patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)');
460 // Add 'Disclosures (write,addonly optional)' object (added in 5.0.1)
461 addObjectAcl('patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)');
462 // Add 'Prescriptions (write,addonly optional)' object (added in 5.0.1)
463 addObjectAcl('patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)');
464 // Add 'Amendments (write,addonly optional)' object (added in 5.0.1)
465 addObjectAcl('patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)');
466 // Add 'Lab Results (write,addonly optional)' object (added in 5.0.1)
467 addObjectAcl('patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)');
469 //Update already existing Objects
470 // echo "<BR/><B>Upgrading objects</B><BR/>";
472 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
473 // (will also place in the appropriate group and CREATE a new group if needed)
474 // echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
476 //Update the ACLs
477 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
478 //Insert the 'reminder' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
479 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
480 //Insert the 'alert' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
481 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
482 //Insert the 'disclosure' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
483 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
484 //Insert the 'rx' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
485 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
486 //Insert the 'amendment' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
487 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
488 //Insert the 'lab' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
489 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
490 //DONE with upgrading to this version
491 $acl_version = $upgrade_acl;
494 //This is a template for a new revision, when needed
495 // Upgrade for acl_version 5
496 $upgrade_acl = 5;
497 if ($acl_version < $upgrade_acl) {
498 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
500 //Collect the ACL ID numbers.
501 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
502 //Get Accountant ACL ID number
503 $admin_write = getAclIdNumber('Administrators', 'write');
506 //Add new object Sections
507 echo "<BR/><B>Adding new object sections</B><BR/>";
508 // Add 'Groups' object (added in 5.0.1)
509 addObjectSectionAcl('groups', 'Groups');
512 //Add new Objects
513 echo "<BR/><B>Adding new objects</B><BR/>";
514 // Add 'Multipledb' object (added in 5.0.1)
515 addObjectAcl('admin', 'Administration', 'multipledb', 'Multipledb');
516 addObjectAcl('groups', 'Groups', 'gadd', 'View/Add/Update groups');
517 addObjectAcl('groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar');
518 addObjectAcl('groups', 'Groups', 'glog', 'Group encounter log');
519 addObjectAcl('groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record');
520 addObjectAcl('groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist');
521 //Update already existing Objects
522 echo "<BR/><B>Upgrading objects</B><BR/>";
524 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
525 // (will also place in the appropriate group and CREATE a new group if needed)
526 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
528 //Update the ACLs
529 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
530 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gadd', 'View/Add/Update groups', 'write');
531 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
532 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
533 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record', 'write');
534 updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist', 'write');
535 //Insert the 'Multipledb' object from the 'admin' section into the Administrators group write ACL (added in 5.0.1)
536 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'multipledb', 'Multipledb', 'write');
537 //DONE with upgrading to this version
538 $acl_version = $upgrade_acl;
541 /* This is a template for a new revision, when needed
542 // Upgrade for acl_version 6
543 $upgrade_acl = 6;
544 if ($acl_version < $upgrade_acl) {
545 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
547 //Collect the ACL ID numbers.
548 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
550 //Add new object Sections
551 echo "<BR/><B>Adding new object sections</B><BR/>";
553 //Add new Objects
554 echo "<BR/><B>Adding new objects</B><BR/>";
556 //Update already existing Objects
557 echo "<BR/><B>Upgrading objects</B><BR/>";
559 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
560 // (will also place in the appropriate group and CREATE a new group if needed)
561 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
563 //Update the ACLs
564 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
566 //DONE with upgrading to this version
567 $acl_version = $upgrade_acl;
571 /* This is a template for a new revision, when needed
572 // Upgrade for acl_version 7
573 $upgrade_acl = 7;
574 if ($acl_version < $upgrade_acl) {
575 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
577 //Collect the ACL ID numbers.
578 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
580 //Add new object Sections
581 echo "<BR/><B>Adding new object sections</B><BR/>";
583 //Add new Objects
584 echo "<BR/><B>Adding new objects</B><BR/>";
586 //Update already existing Objects
587 echo "<BR/><B>Upgrading objects</B><BR/>";
589 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
590 // (will also place in the appropriate group and CREATE a new group if needed)
591 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
593 //Update the ACLs
594 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
596 //DONE with upgrading to this version
597 $acl_version = $upgrade_acl;
601 /* This is a template for a new revision, when needed
602 // Upgrade for acl_version 8
603 $upgrade_acl = 8;
604 if ($acl_version < $upgrade_acl) {
605 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
607 //Collect the ACL ID numbers.
608 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
610 //Add new object Sections
611 echo "<BR/><B>Adding new object sections</B><BR/>";
613 //Add new Objects
614 echo "<BR/><B>Adding new objects</B><BR/>";
616 //Update already existing Objects
617 echo "<BR/><B>Upgrading objects</B><BR/>";
619 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
620 // (will also place in the appropriate group and CREATE a new group if needed)
621 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
623 //Update the ACLs
624 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
626 //DONE with upgrading to this version
627 $acl_version = $upgrade_acl;
631 //All done
632 $response = set_acl_version($acl_version);
634 if ($response) {
635 echo "DONE upgrading access controls";
636 } else {
637 echo "ERROR upgrading access control version";