removed pure php in templates/practice_settings/general_list.html
[openemr.git] / acl_upgrade.php
blob6b64079bf4968b61ec69af398a2d877d9c3d7e18
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();
146 else {
147 die("You must first set up library/acl.inc to use phpGACL!");
150 $acl_version = get_acl_version();
151 if (empty($acl_version)) {
152 $acl_version = 0;
155 // Upgrade for acl_version 1
156 $upgrade_acl = 1;
157 if ($acl_version < $upgrade_acl) {
158 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
160 //Collect the ACL ID numbers.
161 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
162 //Get Administrator ACL ID number
163 $admin_write = getAclIdNumber('Administrators', 'write');
164 //Get Doctor ACL ID Number
165 $doc_write = getAclIdNumber('Physicians', 'write');
166 //Get Clinician ACL with write access ID number
167 $clin_write = getAclIdNumber('Clinicians', 'write');
168 //Get Clinician ACL with addonly access ID number
169 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
170 //Get Receptionist ACL ID number
171 $front_write = getAclIdNumber('Front Office', 'write');
172 //Get Accountant ACL ID number
173 $back_write = getAclIdNumber('Accounting', 'write');
175 //Add new object Sections
176 echo "<BR/><B>Adding new object sections</B><BR/>";
177 //Add 'Sensitivities' object section (added in 2.8.2)
178 addObjectSectionAcl('sensitivities', 'Sensitivities');
179 //Add 'Lists' object section (added in 3.0.2)
180 addObjectSectionAcl('lists', 'Lists');
181 //Add 'Placeholder' object section (added in 3.0.2)
182 addObjectSectionAcl('placeholder', 'Placeholder');
183 //Add 'Nation Notes' object section (added in 4.1.0)
184 addObjectSectionAcl('nationnotes','Nation Notes');
185 //Add 'Patient Portal' object section (added in 4.1.0)
186 addObjectSectionAcl('patientportal', 'Patient Portal');
188 //Add new Objects
189 echo "<BR/><B>Adding new objects</B><BR/>";
190 //Add 'Normal' sensitivity object, order variable is default 10 (added in 2.8.2)
191 addObjectAcl('sensitivities', 'Sensitivities', 'normal', 'Normal');
192 //Add 'High' sensitivity object, order variable is set to 20 (added in 2.8.2)
193 addObjectAclWithOrder('sensitivities', 'Sensitivities', 'high', 'High', 20);
194 //Add 'Pharmacy Dispensary' object (added in 2.8.4)
195 addObjectAcl('admin', 'Administration', 'drugs', 'Pharmacy Dispensary');
196 //Add 'ACL Administration' object (added in 2.8.4)
197 addObjectAcl('admin', 'Administration', 'acl', 'ACL Administration');
198 //Add 'Price Discounting' object (added in 2.8.4)
199 addObjectAcl('acct', 'Accounting', 'disc', 'Price Discounting');
200 //Add 'Default List (write,addonly optional)' object (added in 3.0.2)
201 addObjectAcl('lists', 'Lists', 'default', 'Default List (write,addonly optional)');
202 //Add 'State List (write,addonly optional)' object (added in 3.0.2)
203 addObjectAcl('lists', 'Lists', 'state', 'State List (write,addonly optional)');
204 //Add 'Country List (write,addonly optional)' object (added in 3.0.2)
205 addObjectAcl('lists', 'Lists', 'country', 'Country List (write,addonly optional)');
206 //Add 'Language List (write,addonly optional)' object (added in 3.0.2)
207 addObjectAcl('lists', 'Lists', 'language', 'Language List (write,addonly optional)');
208 //Add 'Ethnicity-Race List (write,addonly optional)' object (added in 3.0.2)
209 addObjectAcl('lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)');
210 //Add 'Placeholder (Maintains empty ACLs)' object (added in 3.0.2)
211 addObjectAcl('placeholder', 'Placeholder', 'filler', 'Placeholder (Maintains empty ACLs)');
212 //Add 'Sign Lab Results (write,addonly optional)' object (added in 3.3.0)
213 addObjectAcl('patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)');
214 //Add 'nationnotes' object (added in 4.1.0)
215 addObjectAcl('nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure');
216 //Add 'patientportal' object (added in 4.1.0)
217 addObjectAcl('patientportal', 'Patient Portal', 'portal', 'Patient Portal');
219 //Update already existing Objects
220 echo "<BR/><B>Upgrading objects</B><BR/>";
221 //Ensure that 'High' sensitivity object order variable is set to 20
222 editObjectAcl('sensitivities', 'Sensitivities', 'high', 'High', 20);
224 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
225 // (will also place in the appropriate group and CREATE a new group if needed)
226 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
227 //Add 'Physicians' ACL with 'addonly' and collect the ID number (added in 3.0.2)
228 $doc_addonly = addNewACL('Physicians', 'doc', 'addonly', 'Things that physicians can read and enter but not modify');
229 //Add 'Front Office' ACL with 'addonly' and collect the ID number (added in 3.0.2)
230 $front_addonly = addNewACL('Front Office', 'front', 'addonly', 'Things that front office can read and enter but not modify');
231 //Add 'Accounting' ACL with 'addonly' and collect the ID number (added in 3.0.2)
232 $back_addonly = addNewACL('Accounting', 'back', 'addonly', 'Things that back office can read and enter but not modify');
233 //Add 'Emergency Login' ACL with 'write' and collect the ID number (added in 3.3.0)
234 $emergency_write = addNewACL('Emergency Login', 'breakglass', 'write', 'Things that can use for emergency login, can read and modify');
236 //Update the ACLs
237 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
238 //Insert the 'super' object from the 'admin' section into the Administrators group write ACL (added in 2.8.2)
239 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'super', 'Superuser', 'write');
240 //Insert the 'high' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
241 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
242 //Insert the 'normal' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
243 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
244 //Insert the 'high' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
245 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
246 //Insert the 'normal' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
247 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
248 //Insert the 'normal' object from the 'sensitivities' section into the Clinicians group addonly ACL (added in 2.8.2)
249 updateAcl($clin_addonly, 'Clinicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'addonly');
250 //Insert the 'drugs' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
251 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
252 //Insert the 'drugs' object from the 'admin' section into the Physicians group write ACL (added in 2.8.4)
253 updateAcl($doc_write, 'Physicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
254 //Insert the 'drugs' object from the 'admin' section into the Clinicians group write ACL (added in 2.8.4)
255 updateAcl($clin_write, 'Clinicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
256 //Insert the 'acl' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
257 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
258 //Insert the 'disc' object from the 'acct' section into the Administrators group write ACL (added in 2.8.4)
259 updateAcl($admin_write, 'Administrators', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
260 //Insert the 'disc' object from the 'acct' section into the Accounting group write ACL (added in 2.8.4)
261 updateAcl($back_write, 'Accounting', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
262 //Insert the 'disc' object from the 'acct' section into the Physicians group write ACL (added in 2.8.4)
263 updateAcl($doc_write, 'Physicians', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
264 //Insert the 'default' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
265 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
266 //Insert the 'state' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
267 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
268 //Insert the 'country' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
269 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
270 //Insert the 'language' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
271 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
272 //Insert the 'race' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
273 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
274 //Update ACLs for Emergency Login
275 //Insert the 'disc' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
276 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
277 //Insert the 'bill' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
278 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'bill', 'Billing (write optional)', 'write');
279 //Insert the 'eob' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
280 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'eob', 'EOB Data Entry', 'write');
281 //Insert the 'rep' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
282 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep', 'Financial Reporting - my encounters', 'write');
283 //Insert the 'rep_a' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
284 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep_a', 'Financial Reporting - anything', 'write');
285 //Insert the 'calendar' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
286 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'calendar', 'Calendar Settings', 'write');
287 //Insert the 'database' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
288 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'database', 'Database Reporting', 'write');
289 //Insert the 'forms' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
290 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'forms', 'Forms Administration', 'write');
291 //Insert the 'practice' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
292 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'practice', 'Practice Settings', 'write');
293 //Insert the 'superbill' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
294 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'superbill', 'Superbill Codes Administration', 'write');
295 //Insert the 'users' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
296 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'users', 'Users/Groups/Logs Administration', 'write');
297 //Insert the 'batchcom' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
298 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'batchcom', 'Batch Communication Tool', 'write');
299 //Insert the 'language' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
300 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'language', 'Language Interface Tool', 'write');
301 //Insert the 'super' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
302 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'super', 'Superuser', 'write');
303 //Insert the 'drugs' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
304 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
305 //Insert the 'acl' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
306 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
307 //Insert the 'auth_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
308 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth_a', 'Authorize - any encounters', 'write');
309 //Insert the 'coding_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
310 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding_a', 'Coding - any encounters (write,wsome optional)', 'write');
311 //Insert the 'notes_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
312 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes_a', 'Notes - any encounters (write,addonly optional)', 'write');
313 //Insert the 'date_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
314 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'date_a', 'Fix encounter dates - any encounters', 'write');
315 //Insert the 'default' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
316 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
317 //Insert the 'state' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
318 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
319 //Insert the 'country' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
320 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
321 //Insert the 'language' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
322 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
323 //Insert the 'ethrace' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
324 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
325 //Insert the 'appt' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
326 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'appt', 'Appointments (write,wsome optional)', 'write');
327 //Insert the 'demo' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
328 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'demo', 'Demographics (write,addonly optional)', 'write');
329 //Insert the 'med' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
330 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'med', 'Medical/History (write,addonly optional)', 'write');
331 //Insert the 'trans' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
332 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'write');
333 //Insert the 'docs' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
334 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs', 'Documents (write,addonly optional)', 'write');
335 //Insert the 'notes' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
336 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'notes', 'Patient Notes (write,addonly optional)', 'write');
337 //Insert the 'high' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
338 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
339 //Insert the 'normal' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
340 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
341 //Insert the 'sign' object from the 'patients' section into the Physicians group write ACL (added in 3.3.0)
342 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
343 //Insert the 'sign' object from the 'nationnotes' section into the Administrators group write ACL (added in 3.3.0)
344 updateAcl($admin_write, 'Administrators','nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure','write');
345 //Insert the 'sign' object from the 'nationnotes' section into the Emergency Login group write ACL (added in 3.3.0)
346 updateAcl($emergency_write, 'Emergency Login','nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure','write');
347 //Insert the 'patientportal' object from the 'patientportal' section into the Administrators group write ACL (added in 4.1.0)
348 updateAcl($admin_write, 'Administrators','patientportal', 'Patient Portal', 'portal', 'Patient Portal','write');
349 //Insert the 'patientportal' object from the 'patientportal' section into the Emergency Login group write ACL (added in 4.1.0)
350 updateAcl($emergency_write, 'Emergency Login','patientportal', 'Patient Portal', 'portal', 'Patient Portal','write');
352 //DONE with upgrading to this version
353 $acl_version = $upgrade_acl;
356 // Upgrade for acl_version 2
357 $upgrade_acl = 2;
358 if ($acl_version < $upgrade_acl) {
359 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
361 //Collect the ACL ID numbers.
362 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
364 //Add new object Sections
365 echo "<BR/><B>Adding new object sections</B><BR/>";
367 //Add new Objects
368 echo "<BR/><B>Adding new objects</B><BR/>";
370 //Update already existing Objects
371 echo "<BR/><B>Upgrading objects</B><BR/>";
373 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
374 // (will also place in the appropriate group and CREATE a new group if needed)
375 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
376 addNewACL('Physicians', 'doc', 'wsome', 'Things that physicians can read and partly modify');
377 addNewACL('Clinicians', 'clin', 'wsome', 'Things that clinicians can read and partly modify');
378 addNewACL('Front Office', 'front', 'wsome', 'Things that front office can read and partly modify');
379 addNewACL('Accounting', 'back', 'wsome', 'Things that back office can read and partly modify');
380 addNewACL('Physicians', 'doc', 'view', 'Things that physicians can only read');
381 addNewACL('Clinicians', 'clin', 'view', 'Things that clinicians can only read');
382 addNewACL('Front Office', 'front', 'view', 'Things that front office can only read');
383 addNewACL('Accounting', 'back', 'view', 'Things that back office can only read');
385 //Update the ACLs
386 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
388 //DONE with upgrading to this version
389 $acl_version = $upgrade_acl;
392 // Upgrade for acl_version 3
393 $upgrade_acl = 3;
394 if ($acl_version < $upgrade_acl) {
395 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
397 //Collect the ACL ID numbers.
398 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
399 //Get Administrator ACL ID number
400 $admin_write = getAclIdNumber('Administrators', 'write');
401 //Get Emergency ACL ID number
402 $emergency_write = getAclIdNumber('Emergency Login', 'write');
404 //Add new object Sections
405 echo "<BR/><B>Adding new object sections</B><BR/>";
406 //Add 'Menus' object section (added in 4.1.3)
407 addObjectSectionAcl('menus', 'Menus');
409 //Add new Objects
410 echo "<BR/><B>Adding new objects</B><BR/>";
411 //Add 'modules' object (added in 4.1.3)
412 addObjectAcl('menus', 'Menus', 'modle', 'Modules');
414 //Update already existing Objects
415 echo "<BR/><B>Upgrading objects</B><BR/>";
417 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
418 // (will also place in the appropriate group and CREATE a new group if needed)
419 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
421 //Update the ACLs
422 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
423 //Insert the 'Modules' object from the 'Menus' section into the Administrators group write ACL (added in 4.1.3)
424 updateAcl($admin_write, 'Administrators','menus', 'Menus', 'modle', 'Modules', 'write');
425 //Insert the 'Modules' object from the 'Menus' section into the Emergency Login group write ACL (added in 4.1.3)
426 updateAcl($emergency_write, 'Emergency Login','menus', 'Menus', 'modle', 'Modules', 'write');
428 //DONE with upgrading to this version
429 $acl_version = $upgrade_acl;
432 // Upgrade for acl_version 4
433 $upgrade_acl = 4;
434 if ($acl_version < $upgrade_acl) {
435 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
437 //Collect the ACL ID numbers.
438 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
439 //Get Administrator ACL ID number
440 $admin_write = getAclIdNumber('Administrators', 'write');
441 //Get Doctor ACL ID Number
442 $doc_write = getAclIdNumber('Physicians', 'write');
443 //Get Clinician ACL with write access ID number
444 $clin_write = getAclIdNumber('Clinicians', 'write');
445 //Get Clinician ACL with addonly access ID number
446 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
447 //Get Receptionist ACL ID number
448 $front_write = getAclIdNumber('Front Office', 'write');
449 //Get Accountant ACL ID number
450 $back_write = getAclIdNumber('Accounting', 'write');
452 //Add new object Sections
453 // echo "<BR/><B>Adding new object sections</B><BR/>";
455 //Add new Objects
456 echo "<BR/><B>Adding new objects</B><BR/>";
457 // Add 'Patient Reminders (write,addonly optional)' object (added in 5.0.1)
458 addObjectAcl('patients', 'Patients', 'reminder' , 'Patient Reminders (write,addonly optional)');
459 // Add 'Clinical Reminders/Alerts (write,addonly optional)' object (added in 5.0.1)
460 addObjectAcl('patients', 'Patients', 'alert' , 'Clinical Reminders/Alerts (write,addonly optional)');
461 // Add 'Disclosures (write,addonly optional)' object (added in 5.0.1)
462 addObjectAcl('patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)');
463 // Add 'Prescriptions (write,addonly optional)' object (added in 5.0.1)
464 addObjectAcl('patients', 'Patients', 'rx' , 'Prescriptions (write,addonly optional)');
465 // Add 'Amendments (write,addonly optional)' object (added in 5.0.1)
466 addObjectAcl('patients', 'Patients', 'amendment' , 'Amendments (write,addonly optional)');
467 // Add 'Lab Results (write,addonly optional)' object (added in 5.0.1)
468 addObjectAcl('patients', 'Patients', 'lab' , 'Lab Results (write,addonly optional)');
470 //Update already existing Objects
471 // echo "<BR/><B>Upgrading objects</B><BR/>";
473 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
474 // (will also place in the appropriate group and CREATE a new group if needed)
475 // echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
477 //Update the ACLs
478 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
479 //Insert the 'reminder' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
480 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
481 //Insert the 'alert' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
482 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
483 //Insert the 'disclosure' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
484 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
485 //Insert the 'rx' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
486 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
487 //Insert the 'amendment' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
488 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
489 //Insert the 'lab' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
490 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
491 //DONE with upgrading to this version
492 $acl_version = $upgrade_acl;
495 //This is a template for a new revision, when needed
496 // Upgrade for acl_version 5
497 $upgrade_acl = 5;
498 if ($acl_version < $upgrade_acl) {
499 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
501 //Collect the ACL ID numbers.
502 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
503 //Get Accountant ACL ID number
504 $admin_write = getAclIdNumber('Administrators', 'write');
507 //Add new object Sections
508 echo "<BR/><B>Adding new object sections</B><BR/>";
509 // Add 'Groups' object (added in 5.0.1)
510 addObjectSectionAcl('groups', 'Groups');
513 //Add new Objects
514 echo "<BR/><B>Adding new objects</B><BR/>";
515 // Add 'Multipledb' object (added in 5.0.1)
516 addObjectAcl('admin', 'Administration', 'multipledb', 'Multipledb');
517 addObjectAcl('groups', 'Groups', 'gadd' , 'View/Add/Update groups');
518 addObjectAcl('groups', 'Groups', 'gcalendar' , 'View/Create/Update groups appointment in calendar');
519 addObjectAcl('groups', 'Groups', 'glog' , 'Group encounter log');
520 addObjectAcl('groups', 'Groups', 'gdlog' , 'Group detailed log of appointment in patient record');
521 addObjectAcl('groups', 'Groups', 'gm' , 'Send message from the permanent group therapist to the personal therapist');
522 //Update already existing Objects
523 echo "<BR/><B>Upgrading objects</B><BR/>";
525 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
526 // (will also place in the appropriate group and CREATE a new group if needed)
527 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
529 //Update the ACLs
530 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
531 updateAcl($admin_write, 'Administrators','groups', 'Groups', 'gadd', 'View/Add/Update groups','write');
532 updateAcl($admin_write, 'Administrators','groups', 'Groups', 'gcalendar','View/Create/Update groups appointment in calendar','write');
533 updateAcl($admin_write, 'Administrators','groups', 'Groups', 'glog', 'Group encounter log','write');
534 updateAcl($admin_write, 'Administrators','groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record','write');
535 updateAcl($admin_write, 'Administrators','groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist','write');
536 //Insert the 'Multipledb' object from the 'admin' section into the Administrators group write ACL (added in 5.0.1)
537 updateAcl($admin_write, 'Administrators','admin', 'Administration', 'multipledb', 'Multipledb','write');
538 //DONE with upgrading to this version
539 $acl_version = $upgrade_acl;
542 /* This is a template for a new revision, when needed
543 // Upgrade for acl_version 6
544 $upgrade_acl = 6;
545 if ($acl_version < $upgrade_acl) {
546 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
548 //Collect the ACL ID numbers.
549 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
551 //Add new object Sections
552 echo "<BR/><B>Adding new object sections</B><BR/>";
554 //Add new Objects
555 echo "<BR/><B>Adding new objects</B><BR/>";
557 //Update already existing Objects
558 echo "<BR/><B>Upgrading objects</B><BR/>";
560 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
561 // (will also place in the appropriate group and CREATE a new group if needed)
562 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
564 //Update the ACLs
565 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
567 //DONE with upgrading to this version
568 $acl_version = $upgrade_acl;
572 /* This is a template for a new revision, when needed
573 // Upgrade for acl_version 7
574 $upgrade_acl = 7;
575 if ($acl_version < $upgrade_acl) {
576 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
578 //Collect the ACL ID numbers.
579 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
581 //Add new object Sections
582 echo "<BR/><B>Adding new object sections</B><BR/>";
584 //Add new Objects
585 echo "<BR/><B>Adding new objects</B><BR/>";
587 //Update already existing Objects
588 echo "<BR/><B>Upgrading objects</B><BR/>";
590 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
591 // (will also place in the appropriate group and CREATE a new group if needed)
592 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
594 //Update the ACLs
595 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
597 //DONE with upgrading to this version
598 $acl_version = $upgrade_acl;
602 /* This is a template for a new revision, when needed
603 // Upgrade for acl_version 8
604 $upgrade_acl = 8;
605 if ($acl_version < $upgrade_acl) {
606 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
608 //Collect the ACL ID numbers.
609 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
611 //Add new object Sections
612 echo "<BR/><B>Adding new object sections</B><BR/>";
614 //Add new Objects
615 echo "<BR/><B>Adding new objects</B><BR/>";
617 //Update already existing Objects
618 echo "<BR/><B>Upgrading objects</B><BR/>";
620 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
621 // (will also place in the appropriate group and CREATE a new group if needed)
622 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
624 //Update the ACLs
625 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
627 //DONE with upgrading to this version
628 $acl_version = $upgrade_acl;
632 //All done
633 $response = set_acl_version($acl_version);
635 if ($response) {
636 echo "DONE upgrading access controls";
637 } else {
638 echo "ERROR upgrading access control version";