fix bug at multipledb difine primary key and auto increment
[openemr.git] / acl_upgrade.php
blob472d4614551b95905aa1a413b2a556f3ec6e868c
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 * </pre>
93 * Copyright (C) 2012 Brady Miller <brady@sparmy.com>
95 * LICENSE: This program is free software; you can redistribute it and/or
96 * modify it under the terms of the GNU General Public License
97 * as published by the Free Software Foundation; either version 2
98 * of the License, or (at your option) any later version.
99 * This program is distributed in the hope that it will be useful,
100 * but WITHOUT ANY WARRANTY; without even the implied warranty of
101 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
102 * GNU General Public License for more details.
103 * You should have received a copy of the GNU General Public License
104 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
106 * @package OpenEMR
107 * @author Brady Miller <brady@sparmy.com>
108 * @link http://www.open-emr.org
111 $ignoreAuth = true; // no login required
113 require_once('interface/globals.php');
114 require_once("$srcdir/acl_upgrade_fx.php");
116 //Ensure that phpGACL has been installed
117 include_once('library/acl.inc');
118 if (isset ($phpgacl_location)) {
119 include_once("$phpgacl_location/gacl_api.class.php");
120 $gacl = new gacl_api();
122 else {
123 die("You must first set up library/acl.inc to use phpGACL!");
126 $acl_version = get_acl_version();
127 if (empty($acl_version)) {
128 $acl_version = 0;
131 // Upgrade for acl_version 1
132 $upgrade_acl = 1;
133 if ($acl_version < $upgrade_acl) {
134 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
136 //Collect the ACL ID numbers.
137 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
138 //Get Administrator ACL ID number
139 $admin_write = getAclIdNumber('Administrators', 'write');
140 //Get Doctor ACL ID Number
141 $doc_write = getAclIdNumber('Physicians', 'write');
142 //Get Clinician ACL with write access ID number
143 $clin_write = getAclIdNumber('Clinicians', 'write');
144 //Get Clinician ACL with addonly access ID number
145 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
146 //Get Receptionist ACL ID number
147 $front_write = getAclIdNumber('Front Office', 'write');
148 //Get Accountant ACL ID number
149 $back_write = getAclIdNumber('Accounting', 'write');
151 //Add new object Sections
152 echo "<BR/><B>Adding new object sections</B><BR/>";
153 //Add 'Sensitivities' object section (added in 2.8.2)
154 addObjectSectionAcl('sensitivities', 'Sensitivities');
155 //Add 'Lists' object section (added in 3.0.2)
156 addObjectSectionAcl('lists', 'Lists');
157 //Add 'Placeholder' object section (added in 3.0.2)
158 addObjectSectionAcl('placeholder', 'Placeholder');
159 //Add 'Nation Notes' object section (added in 4.1.0)
160 addObjectSectionAcl('nationnotes','Nation Notes');
161 //Add 'Patient Portal' object section (added in 4.1.0)
162 addObjectSectionAcl('patientportal', 'Patient Portal');
164 //Add new Objects
165 echo "<BR/><B>Adding new objects</B><BR/>";
166 //Add 'Normal' sensitivity object, order variable is default 10 (added in 2.8.2)
167 addObjectAcl('sensitivities', 'Sensitivities', 'normal', 'Normal');
168 //Add 'High' sensitivity object, order variable is set to 20 (added in 2.8.2)
169 addObjectAclWithOrder('sensitivities', 'Sensitivities', 'high', 'High', 20);
170 //Add 'Pharmacy Dispensary' object (added in 2.8.4)
171 addObjectAcl('admin', 'Administration', 'drugs', 'Pharmacy Dispensary');
172 //Add 'ACL Administration' object (added in 2.8.4)
173 addObjectAcl('admin', 'Administration', 'acl', 'ACL Administration');
174 //Add 'Price Discounting' object (added in 2.8.4)
175 addObjectAcl('acct', 'Accounting', 'disc', 'Price Discounting');
176 //Add 'Default List (write,addonly optional)' object (added in 3.0.2)
177 addObjectAcl('lists', 'Lists', 'default', 'Default List (write,addonly optional)');
178 //Add 'State List (write,addonly optional)' object (added in 3.0.2)
179 addObjectAcl('lists', 'Lists', 'state', 'State List (write,addonly optional)');
180 //Add 'Country List (write,addonly optional)' object (added in 3.0.2)
181 addObjectAcl('lists', 'Lists', 'country', 'Country List (write,addonly optional)');
182 //Add 'Language List (write,addonly optional)' object (added in 3.0.2)
183 addObjectAcl('lists', 'Lists', 'language', 'Language List (write,addonly optional)');
184 //Add 'Ethnicity-Race List (write,addonly optional)' object (added in 3.0.2)
185 addObjectAcl('lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)');
186 //Add 'Placeholder (Maintains empty ACLs)' object (added in 3.0.2)
187 addObjectAcl('placeholder', 'Placeholder', 'filler', 'Placeholder (Maintains empty ACLs)');
188 //Add 'Sign Lab Results (write,addonly optional)' object (added in 3.3.0)
189 addObjectAcl('patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)');
190 //Add 'nationnotes' object (added in 4.1.0)
191 addObjectAcl('nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure');
192 //Add 'patientportal' object (added in 4.1.0)
193 addObjectAcl('patientportal', 'Patient Portal', 'portal', 'Patient Portal');
195 //Update already existing Objects
196 echo "<BR/><B>Upgrading objects</B><BR/>";
197 //Ensure that 'High' sensitivity object order variable is set to 20
198 editObjectAcl('sensitivities', 'Sensitivities', 'high', 'High', 20);
200 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
201 // (will also place in the appropriate group and CREATE a new group if needed)
202 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
203 //Add 'Physicians' ACL with 'addonly' and collect the ID number (added in 3.0.2)
204 $doc_addonly = addNewACL('Physicians', 'doc', 'addonly', 'Things that physicians can read and enter but not modify');
205 //Add 'Front Office' ACL with 'addonly' and collect the ID number (added in 3.0.2)
206 $front_addonly = addNewACL('Front Office', 'front', 'addonly', 'Things that front office can read and enter but not modify');
207 //Add 'Accounting' ACL with 'addonly' and collect the ID number (added in 3.0.2)
208 $back_addonly = addNewACL('Accounting', 'back', 'addonly', 'Things that back office can read and enter but not modify');
209 //Add 'Emergency Login' ACL with 'write' and collect the ID number (added in 3.3.0)
210 $emergency_write = addNewACL('Emergency Login', 'breakglass', 'write', 'Things that can use for emergency login, can read and modify');
212 //Update the ACLs
213 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
214 //Insert the 'super' object from the 'admin' section into the Administrators group write ACL (added in 2.8.2)
215 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'super', 'Superuser', 'write');
216 //Insert the 'high' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
217 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
218 //Insert the 'normal' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
219 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
220 //Insert the 'high' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
221 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
222 //Insert the 'normal' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
223 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
224 //Insert the 'normal' object from the 'sensitivities' section into the Clinicians group addonly ACL (added in 2.8.2)
225 updateAcl($clin_addonly, 'Clinicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'addonly');
226 //Insert the 'drugs' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
227 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
228 //Insert the 'drugs' object from the 'admin' section into the Physicians group write ACL (added in 2.8.4)
229 updateAcl($doc_write, 'Physicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
230 //Insert the 'drugs' object from the 'admin' section into the Clinicians group write ACL (added in 2.8.4)
231 updateAcl($clin_write, 'Clinicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
232 //Insert the 'acl' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
233 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
234 //Insert the 'disc' object from the 'acct' section into the Administrators group write ACL (added in 2.8.4)
235 updateAcl($admin_write, 'Administrators', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
236 //Insert the 'disc' object from the 'acct' section into the Accounting group write ACL (added in 2.8.4)
237 updateAcl($back_write, 'Accounting', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
238 //Insert the 'disc' object from the 'acct' section into the Physicians group write ACL (added in 2.8.4)
239 updateAcl($doc_write, 'Physicians', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
240 //Insert the 'default' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
241 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
242 //Insert the 'state' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
243 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
244 //Insert the 'country' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
245 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
246 //Insert the 'language' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
247 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
248 //Insert the 'race' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
249 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
250 //Update ACLs for Emergency Login
251 //Insert the 'disc' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
252 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
253 //Insert the 'bill' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
254 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'bill', 'Billing (write optional)', 'write');
255 //Insert the 'eob' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
256 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'eob', 'EOB Data Entry', 'write');
257 //Insert the 'rep' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
258 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep', 'Financial Reporting - my encounters', 'write');
259 //Insert the 'rep_a' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
260 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep_a', 'Financial Reporting - anything', 'write');
261 //Insert the 'calendar' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
262 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'calendar', 'Calendar Settings', 'write');
263 //Insert the 'database' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
264 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'database', 'Database Reporting', 'write');
265 //Insert the 'forms' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
266 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'forms', 'Forms Administration', 'write');
267 //Insert the 'practice' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
268 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'practice', 'Practice Settings', 'write');
269 //Insert the 'superbill' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
270 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'superbill', 'Superbill Codes Administration', 'write');
271 //Insert the 'users' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
272 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'users', 'Users/Groups/Logs Administration', 'write');
273 //Insert the 'batchcom' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
274 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'batchcom', 'Batch Communication Tool', 'write');
275 //Insert the 'language' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
276 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'language', 'Language Interface Tool', 'write');
277 //Insert the 'super' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
278 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'super', 'Superuser', 'write');
279 //Insert the 'drugs' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
280 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
281 //Insert the 'acl' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
282 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
283 //Insert the 'auth_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
284 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth_a', 'Authorize - any encounters', 'write');
285 //Insert the 'coding_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
286 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding_a', 'Coding - any encounters (write,wsome optional)', 'write');
287 //Insert the 'notes_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
288 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes_a', 'Notes - any encounters (write,addonly optional)', 'write');
289 //Insert the 'date_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
290 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'date_a', 'Fix encounter dates - any encounters', 'write');
291 //Insert the 'default' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
292 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
293 //Insert the 'state' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
294 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
295 //Insert the 'country' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
296 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
297 //Insert the 'language' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
298 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
299 //Insert the 'ethrace' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
300 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
301 //Insert the 'appt' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
302 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'appt', 'Appointments (write,wsome optional)', 'write');
303 //Insert the 'demo' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
304 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'demo', 'Demographics (write,addonly optional)', 'write');
305 //Insert the 'med' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
306 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'med', 'Medical/History (write,addonly optional)', 'write');
307 //Insert the 'trans' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
308 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'write');
309 //Insert the 'docs' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
310 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs', 'Documents (write,addonly optional)', 'write');
311 //Insert the 'notes' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
312 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'notes', 'Patient Notes (write,addonly optional)', 'write');
313 //Insert the 'high' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
314 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
315 //Insert the 'normal' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
316 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
317 //Insert the 'sign' object from the 'patients' section into the Physicians group write ACL (added in 3.3.0)
318 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
319 //Insert the 'sign' object from the 'nationnotes' section into the Administrators group write ACL (added in 3.3.0)
320 updateAcl($admin_write, 'Administrators','nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure','write');
321 //Insert the 'sign' object from the 'nationnotes' section into the Emergency Login group write ACL (added in 3.3.0)
322 updateAcl($emergency_write, 'Emergency Login','nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure','write');
323 //Insert the 'patientportal' object from the 'patientportal' section into the Administrators group write ACL (added in 4.1.0)
324 updateAcl($admin_write, 'Administrators','patientportal', 'Patient Portal', 'portal', 'Patient Portal','write');
325 //Insert the 'patientportal' object from the 'patientportal' section into the Emergency Login group write ACL (added in 4.1.0)
326 updateAcl($emergency_write, 'Emergency Login','patientportal', 'Patient Portal', 'portal', 'Patient Portal','write');
328 //DONE with upgrading to this version
329 $acl_version = $upgrade_acl;
332 // Upgrade for acl_version 2
333 $upgrade_acl = 2;
334 if ($acl_version < $upgrade_acl) {
335 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
337 //Collect the ACL ID numbers.
338 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
340 //Add new object Sections
341 echo "<BR/><B>Adding new object sections</B><BR/>";
343 //Add new Objects
344 echo "<BR/><B>Adding new objects</B><BR/>";
346 //Update already existing Objects
347 echo "<BR/><B>Upgrading objects</B><BR/>";
349 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
350 // (will also place in the appropriate group and CREATE a new group if needed)
351 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
352 addNewACL('Physicians', 'doc', 'wsome', 'Things that physicians can read and partly modify');
353 addNewACL('Clinicians', 'clin', 'wsome', 'Things that clinicians can read and partly modify');
354 addNewACL('Front Office', 'front', 'wsome', 'Things that front office can read and partly modify');
355 addNewACL('Accounting', 'back', 'wsome', 'Things that back office can read and partly modify');
356 addNewACL('Physicians', 'doc', 'view', 'Things that physicians can only read');
357 addNewACL('Clinicians', 'clin', 'view', 'Things that clinicians can only read');
358 addNewACL('Front Office', 'front', 'view', 'Things that front office can only read');
359 addNewACL('Accounting', 'back', 'view', 'Things that back office can only read');
361 //Update the ACLs
362 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
364 //DONE with upgrading to this version
365 $acl_version = $upgrade_acl;
368 // Upgrade for acl_version 3
369 $upgrade_acl = 3;
370 if ($acl_version < $upgrade_acl) {
371 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
373 //Collect the ACL ID numbers.
374 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
375 //Get Administrator ACL ID number
376 $admin_write = getAclIdNumber('Administrators', 'write');
377 //Get Emergency ACL ID number
378 $emergency_write = getAclIdNumber('Emergency Login', 'write');
380 //Add new object Sections
381 echo "<BR/><B>Adding new object sections</B><BR/>";
382 //Add 'Menus' object section (added in 4.1.3)
383 addObjectSectionAcl('menus', 'Menus');
385 //Add new Objects
386 echo "<BR/><B>Adding new objects</B><BR/>";
387 //Add 'modules' object (added in 4.1.3)
388 addObjectAcl('menus', 'Menus', 'modle', 'Modules');
390 //Update already existing Objects
391 echo "<BR/><B>Upgrading objects</B><BR/>";
393 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
394 // (will also place in the appropriate group and CREATE a new group if needed)
395 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
397 //Update the ACLs
398 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
399 //Insert the 'Modules' object from the 'Menus' section into the Administrators group write ACL (added in 4.1.3)
400 updateAcl($admin_write, 'Administrators','menus', 'Menus', 'modle', 'Modules', 'write');
401 //Insert the 'Modules' object from the 'Menus' section into the Emergency Login group write ACL (added in 4.1.3)
402 updateAcl($emergency_write, 'Emergency Login','menus', 'Menus', 'modle', 'Modules', 'write');
404 //DONE with upgrading to this version
405 $acl_version = $upgrade_acl;
408 /* This is a template for a new revision, when needed
409 // Upgrade for acl_version 4
410 $upgrade_acl = 4;
411 if ($acl_version < $upgrade_acl) {
412 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
414 //Collect the ACL ID numbers.
415 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
417 //Add new object Sections
418 echo "<BR/><B>Adding new object sections</B><BR/>";
420 //Add new Objects
421 echo "<BR/><B>Adding new objects</B><BR/>";
423 //Update already existing Objects
424 echo "<BR/><B>Upgrading objects</B><BR/>";
426 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
427 // (will also place in the appropriate group and CREATE a new group if needed)
428 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
430 //Update the ACLs
431 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
433 //DONE with upgrading to this version
434 $acl_version = $upgrade_acl;
438 //All done
439 $response = set_acl_version($acl_version);
441 if ($response) {
442 echo "DONE upgrading access controls";
443 } else {
444 echo "ERROR upgrading access control version";