fix: check for empty array before looking for offsite document (#7391)
[openemr.git] / acl_upgrade.php
blob6f4edec8f8ca00cb2cee7af72ea53e0afa2e0143
1 <?php
3 /**
4 * Upgrade script for access controls.
6 * This script will update the phpGACL database, which include
7 * Access Control Objects(ACO), Groups(ARO), and Access Control
8 * Lists(ACL) to the most recent version.
9 * It will display whether each update already exist
10 * or if it was updated successfully.
11 * To avoid reversing customizations, upgrade is done in versions,
12 * which are recorded in the database. To add another version of
13 * changes, use the following template:
14 * <pre>// Upgrade for acl_version <acl_version_here>
15 * $upgrade_acl = <acl_version_here>;
16 * if ($acl_version < $upgrade_acl) {
17 * echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
19 * //Collect the ACL ID numbers.
20 * echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
22 * //Add new object Sections
23 * echo "<BR/><B>Adding new object sections</B><BR/>";
25 * //Add new Objects
26 * echo "<BR/><B>Adding new objects</B><BR/>";
28 * //Update already existing Objects
29 * echo "<BR/><B>Upgrading objects</B><BR/>";
31 * //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
32 * // (will also place in the appropriate group and CREATE a new group if needed)
33 * echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
35 * //Update the ACLs
36 * echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
38 * //DONE with upgrading to this version
39 * $acl_version = $upgrade_acl;
40 * }
41 * </pre>
43 * See header in src/Common/Acl/AclMain.php for list of ACOs
45 * @package OpenEMR
46 * @link http://www.open-emr.org
47 * @author Brady Miller <brady.g.miller@gmail.com>
48 * @copyright Copyright (c) 2012-2017 Brady Miller <brady.g.miller@gmail.com>
49 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
52 // Checks if the server's PHP version is compatible with OpenEMR:
53 require_once(dirname(__FILE__) . "/src/Common/Compatibility/Checker.php");
54 $response = OpenEMR\Common\Compatibility\Checker::checkPhpVersion();
55 if ($response !== true) {
56 die(htmlspecialchars($response));
59 $ignoreAuth = true; // no login required
61 require_once('interface/globals.php');
63 use OpenEMR\Common\Acl\AclExtended;
65 $acl_version = AclExtended::getAclVersion();
66 if (empty($acl_version)) {
67 $acl_version = 0;
70 // Upgrade for acl_version 1
71 $upgrade_acl = 1;
72 if ($acl_version < $upgrade_acl) {
73 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
75 //Collect the ACL ID numbers.
76 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
77 //Get Administrator ACL ID number
78 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
79 //Get Doctor ACL ID Number
80 $doc_write = AclExtended::getAclIdNumber('Physicians', 'write');
81 //Get Clinician ACL with write access ID number
82 $clin_write = AclExtended::getAclIdNumber('Clinicians', 'write');
83 //Get Clinician ACL with addonly access ID number
84 $clin_addonly = AclExtended::getAclIdNumber('Clinicians', 'addonly');
85 //Get Receptionist ACL ID number
86 $front_write = AclExtended::getAclIdNumber('Front Office', 'write');
87 //Get Accountant ACL ID number
88 $back_write = AclExtended::getAclIdNumber('Accounting', 'write');
90 //Add new object Sections
91 echo "<BR/><B>Adding new object sections</B><BR/>";
92 //Add 'Sensitivities' object section (added in 2.8.2)
93 AclExtended::addObjectSectionAcl('sensitivities', 'Sensitivities');
94 //Add 'Lists' object section (added in 3.0.2)
95 AclExtended::addObjectSectionAcl('lists', 'Lists');
96 //Add 'Placeholder' object section (added in 3.0.2)
97 AclExtended::addObjectSectionAcl('placeholder', 'Placeholder');
98 //Add 'Nation Notes' object section (added in 4.1.0)
99 AclExtended::addObjectSectionAcl('nationnotes', 'Nation Notes');
100 //Add 'Patient Portal' object section (added in 4.1.0)
101 AclExtended::addObjectSectionAcl('patientportal', 'Patient Portal');
103 //Add new Objects
104 echo "<BR/><B>Adding new objects</B><BR/>";
105 //Add 'Normal' sensitivity object, order variable is default 10 (added in 2.8.2)
106 AclExtended::addObjectAcl('sensitivities', 'Sensitivities', 'normal', 'Normal');
107 //Add 'High' sensitivity object, order variable is set to 20 (added in 2.8.2)
108 AclExtended::addObjectAclWithOrder('sensitivities', 'Sensitivities', 'high', 'High', 20);
109 //Add 'Pharmacy Dispensary' object (added in 2.8.4)
110 AclExtended::addObjectAcl('admin', 'Administration', 'drugs', 'Pharmacy Dispensary');
111 //Add 'ACL Administration' object (added in 2.8.4)
112 AclExtended::addObjectAcl('admin', 'Administration', 'acl', 'ACL Administration');
113 //Add 'Price Discounting' object (added in 2.8.4)
114 AclExtended::addObjectAcl('acct', 'Accounting', 'disc', 'Price Discounting');
115 //Add 'Default List (write,addonly optional)' object (added in 3.0.2)
116 AclExtended::addObjectAcl('lists', 'Lists', 'default', 'Default List (write,addonly optional)');
117 //Add 'State List (write,addonly optional)' object (added in 3.0.2)
118 AclExtended::addObjectAcl('lists', 'Lists', 'state', 'State List (write,addonly optional)');
119 //Add 'Country List (write,addonly optional)' object (added in 3.0.2)
120 AclExtended::addObjectAcl('lists', 'Lists', 'country', 'Country List (write,addonly optional)');
121 //Add 'Language List (write,addonly optional)' object (added in 3.0.2)
122 AclExtended::addObjectAcl('lists', 'Lists', 'language', 'Language List (write,addonly optional)');
123 //Add 'Ethnicity-Race List (write,addonly optional)' object (added in 3.0.2)
124 AclExtended::addObjectAcl('lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)');
125 //Add 'Placeholder (Maintains empty ACLs)' object (added in 3.0.2)
126 AclExtended::addObjectAcl('placeholder', 'Placeholder', 'filler', 'Placeholder (Maintains empty ACLs)');
127 //Add 'Sign Lab Results (write,addonly optional)' object (added in 3.3.0)
128 AclExtended::addObjectAcl('patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)');
129 //Add 'nationnotes' object (added in 4.1.0)
130 AclExtended::addObjectAcl('nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure');
131 //Add 'patientportal' object (added in 4.1.0)
132 AclExtended::addObjectAcl('patientportal', 'Patient Portal', 'portal', 'Patient Portal');
134 //Update already existing Objects
135 echo "<BR/><B>Upgrading objects</B><BR/>";
136 //Ensure that 'High' sensitivity object order variable is set to 20
137 AclExtended::editObjectAcl('sensitivities', 'Sensitivities', 'high', 'High', 20);
139 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
140 // (will also place in the appropriate group and CREATE a new group if needed)
141 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
142 //Add 'Physicians' ACL with 'addonly' and collect the ID number (added in 3.0.2)
143 $doc_addonly = AclExtended::addNewACL('Physicians', 'doc', 'addonly', 'Things that physicians can read and enter but not modify');
144 //Add 'Front Office' ACL with 'addonly' and collect the ID number (added in 3.0.2)
145 $front_addonly = AclExtended::addNewACL('Front Office', 'front', 'addonly', 'Things that front office can read and enter but not modify');
146 //Add 'Accounting' ACL with 'addonly' and collect the ID number (added in 3.0.2)
147 $back_addonly = AclExtended::addNewACL('Accounting', 'back', 'addonly', 'Things that back office can read and enter but not modify');
148 //Add 'Emergency Login' ACL with 'write' and collect the ID number (added in 3.3.0)
149 $emergency_write = AclExtended::addNewACL('Emergency Login', 'breakglass', 'write', 'Things that can use for emergency login, can read and modify');
151 //Update the ACLs
152 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
153 //Insert the 'super' object from the 'admin' section into the Administrators group write ACL (added in 2.8.2)
154 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'super', 'Superuser', 'write');
155 //Insert the 'high' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
156 AclExtended::updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
157 //Insert the 'normal' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
158 AclExtended::updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
159 //Insert the 'high' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
160 AclExtended::updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
161 //Insert the 'normal' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
162 AclExtended::updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
163 //Insert the 'normal' object from the 'sensitivities' section into the Clinicians group addonly ACL (added in 2.8.2)
164 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'addonly');
165 //Insert the 'drugs' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
166 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
167 //Insert the 'drugs' object from the 'admin' section into the Physicians group write ACL (added in 2.8.4)
168 AclExtended::updateAcl($doc_write, 'Physicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
169 //Insert the 'drugs' object from the 'admin' section into the Clinicians group write ACL (added in 2.8.4)
170 AclExtended::updateAcl($clin_write, 'Clinicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
171 //Insert the 'acl' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
172 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
173 //Insert the 'disc' object from the 'acct' section into the Administrators group write ACL (added in 2.8.4)
174 AclExtended::updateAcl($admin_write, 'Administrators', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
175 //Insert the 'disc' object from the 'acct' section into the Accounting group write ACL (added in 2.8.4)
176 AclExtended::updateAcl($back_write, 'Accounting', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
177 //Insert the 'disc' object from the 'acct' section into the Physicians group write ACL (added in 2.8.4)
178 AclExtended::updateAcl($doc_write, 'Physicians', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
179 //Insert the 'default' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
180 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
181 //Insert the 'state' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
182 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
183 //Insert the 'country' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
184 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
185 //Insert the 'language' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
186 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
187 //Insert the 'race' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
188 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
189 //Update ACLs for Emergency Login
190 //Insert the 'disc' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
191 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
192 //Insert the 'bill' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
193 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'bill', 'Billing (write optional)', 'write');
194 //Insert the 'eob' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
195 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'eob', 'EOB Data Entry', 'write');
196 //Insert the 'rep' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
197 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep', 'Financial Reporting - my encounters', 'write');
198 //Insert the 'rep_a' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
199 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep_a', 'Financial Reporting - anything', 'write');
200 //Insert the 'calendar' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
201 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'calendar', 'Calendar Settings', 'write');
202 //Insert the 'database' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
203 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'database', 'Database Reporting', 'write');
204 //Insert the 'forms' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
205 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'forms', 'Forms Administration', 'write');
206 //Insert the 'practice' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
207 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'practice', 'Practice Settings', 'write');
208 //Insert the 'superbill' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
209 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'superbill', 'Superbill Codes Administration', 'write');
210 //Insert the 'users' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
211 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'users', 'Users/Groups/Logs Administration', 'write');
212 //Insert the 'batchcom' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
213 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'batchcom', 'Batch Communication Tool', 'write');
214 //Insert the 'language' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
215 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'language', 'Language Interface Tool', 'write');
216 //Insert the 'super' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
217 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'super', 'Superuser', 'write');
218 //Insert the 'drugs' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
219 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
220 //Insert the 'acl' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
221 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
222 //Insert the 'auth_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
223 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth_a', 'Authorize - any encounters', 'write');
224 //Insert the 'coding_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
225 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding_a', 'Coding - any encounters (write,wsome optional)', 'write');
226 //Insert the 'notes_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
227 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes_a', 'Notes - any encounters (write,addonly optional)', 'write');
228 //Insert the 'date_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
229 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'date_a', 'Fix encounter dates - any encounters', 'write');
230 //Insert the 'default' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
231 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
232 //Insert the 'state' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
233 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
234 //Insert the 'country' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
235 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
236 //Insert the 'language' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
237 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
238 //Insert the 'ethrace' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
239 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
240 //Insert the 'appt' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
241 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'appt', 'Appointments (write,wsome optional)', 'write');
242 //Insert the 'demo' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
243 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'demo', 'Demographics (write,addonly optional)', 'write');
244 //Insert the 'med' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
245 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'med', 'Medical/History (write,addonly optional)', 'write');
246 //Insert the 'trans' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
247 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'write');
248 //Insert the 'docs' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
249 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs', 'Documents (write,addonly optional)', 'write');
250 //Insert the 'notes' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
251 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'notes', 'Patient Notes (write,addonly optional)', 'write');
252 //Insert the 'high' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
253 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
254 //Insert the 'normal' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
255 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
256 //Insert the 'sign' object from the 'patients' section into the Physicians group write ACL (added in 3.3.0)
257 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
258 //Insert the 'sign' object from the 'nationnotes' section into the Administrators group write ACL (added in 3.3.0)
259 AclExtended::updateAcl($admin_write, 'Administrators', 'nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure', 'write');
260 //Insert the 'sign' object from the 'nationnotes' section into the Emergency Login group write ACL (added in 3.3.0)
261 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure', 'write');
262 //Insert the 'patientportal' object from the 'patientportal' section into the Administrators group write ACL (added in 4.1.0)
263 AclExtended::updateAcl($admin_write, 'Administrators', 'patientportal', 'Patient Portal', 'portal', 'Patient Portal', 'write');
264 //Insert the 'patientportal' object from the 'patientportal' section into the Emergency Login group write ACL (added in 4.1.0)
265 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patientportal', 'Patient Portal', 'portal', 'Patient Portal', 'write');
267 //DONE with upgrading to this version
268 $acl_version = $upgrade_acl;
271 // Upgrade for acl_version 2
272 $upgrade_acl = 2;
273 if ($acl_version < $upgrade_acl) {
274 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
276 //Collect the ACL ID numbers.
277 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
279 //Add new object Sections
280 echo "<BR/><B>Adding new object sections</B><BR/>";
282 //Add new Objects
283 echo "<BR/><B>Adding new objects</B><BR/>";
285 //Update already existing Objects
286 echo "<BR/><B>Upgrading objects</B><BR/>";
288 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
289 // (will also place in the appropriate group and CREATE a new group if needed)
290 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
291 AclExtended::addNewACL('Physicians', 'doc', 'wsome', 'Things that physicians can read and partly modify');
292 AclExtended::addNewACL('Clinicians', 'clin', 'wsome', 'Things that clinicians can read and partly modify');
293 AclExtended::addNewACL('Front Office', 'front', 'wsome', 'Things that front office can read and partly modify');
294 AclExtended::addNewACL('Accounting', 'back', 'wsome', 'Things that back office can read and partly modify');
295 AclExtended::addNewACL('Physicians', 'doc', 'view', 'Things that physicians can only read');
296 AclExtended::addNewACL('Clinicians', 'clin', 'view', 'Things that clinicians can only read');
297 AclExtended::addNewACL('Front Office', 'front', 'view', 'Things that front office can only read');
298 AclExtended::addNewACL('Accounting', 'back', 'view', 'Things that back office can only read');
300 //Update the ACLs
301 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
303 //DONE with upgrading to this version
304 $acl_version = $upgrade_acl;
307 // Upgrade for acl_version 3
308 $upgrade_acl = 3;
309 if ($acl_version < $upgrade_acl) {
310 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
312 //Collect the ACL ID numbers.
313 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
314 //Get Administrator ACL ID number
315 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
316 //Get Emergency ACL ID number
317 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
319 //Add new object Sections
320 echo "<BR/><B>Adding new object sections</B><BR/>";
321 //Add 'Menus' object section (added in 4.1.3)
322 AclExtended::addObjectSectionAcl('menus', 'Menus');
324 //Add new Objects
325 echo "<BR/><B>Adding new objects</B><BR/>";
326 //Add 'modules' object (added in 4.1.3)
327 AclExtended::addObjectAcl('menus', 'Menus', 'modle', 'Modules');
329 //Update already existing Objects
330 echo "<BR/><B>Upgrading objects</B><BR/>";
332 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
333 // (will also place in the appropriate group and CREATE a new group if needed)
334 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
336 //Update the ACLs
337 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
338 //Insert the 'Modules' object from the 'Menus' section into the Administrators group write ACL (added in 4.1.3)
339 AclExtended::updateAcl($admin_write, 'Administrators', 'menus', 'Menus', 'modle', 'Modules', 'write');
340 //Insert the 'Modules' object from the 'Menus' section into the Emergency Login group write ACL (added in 4.1.3)
341 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'menus', 'Menus', 'modle', 'Modules', 'write');
343 //DONE with upgrading to this version
344 $acl_version = $upgrade_acl;
347 // Upgrade for acl_version 4
348 $upgrade_acl = 4;
349 if ($acl_version < $upgrade_acl) {
350 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
352 //Collect the ACL ID numbers.
353 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
354 //Get Administrator ACL ID number
355 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
356 //Get Doctor ACL ID Number
357 $doc_write = AclExtended::getAclIdNumber('Physicians', 'write');
358 //Get Clinician ACL with write access ID number
359 $clin_write = AclExtended::getAclIdNumber('Clinicians', 'write');
360 //Get Clinician ACL with addonly access ID number
361 $clin_addonly = AclExtended::getAclIdNumber('Clinicians', 'addonly');
362 //Get Receptionist ACL ID number
363 $front_write = AclExtended::getAclIdNumber('Front Office', 'write');
364 //Get Accountant ACL ID number
365 $back_write = AclExtended::getAclIdNumber('Accounting', 'write');
367 //Add new object Sections
368 // echo "<BR/><B>Adding new object sections</B><BR/>";
370 //Add new Objects
371 echo "<BR/><B>Adding new objects</B><BR/>";
372 // Add 'Patient Reminders (write,addonly optional)' object (added in 5.0.1)
373 AclExtended::addObjectAcl('patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)');
374 // Add 'Clinical Reminders/Alerts (write,addonly optional)' object (added in 5.0.1)
375 AclExtended::addObjectAcl('patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)');
376 // Add 'Disclosures (write,addonly optional)' object (added in 5.0.1)
377 AclExtended::addObjectAcl('patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)');
378 // Add 'Prescriptions (write,addonly optional)' object (added in 5.0.1)
379 AclExtended::addObjectAcl('patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)');
380 // Add 'Amendments (write,addonly optional)' object (added in 5.0.1)
381 AclExtended::addObjectAcl('patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)');
382 // Add 'Lab Results (write,addonly optional)' object (added in 5.0.1)
383 AclExtended::addObjectAcl('patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)');
385 //Update already existing Objects
386 // echo "<BR/><B>Upgrading objects</B><BR/>";
388 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
389 // (will also place in the appropriate group and CREATE a new group if needed)
390 // echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
392 //Update the ACLs
393 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
394 //Insert the 'reminder' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
395 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
396 //Insert the 'alert' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
397 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
398 //Insert the 'disclosure' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
399 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
400 //Insert the 'rx' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
401 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
402 //Insert the 'amendment' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
403 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
404 //Insert the 'lab' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
405 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
406 //DONE with upgrading to this version
407 $acl_version = $upgrade_acl;
410 //This is a template for a new revision, when needed
411 // Upgrade for acl_version 5
412 $upgrade_acl = 5;
413 if ($acl_version < $upgrade_acl) {
414 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
416 //Collect the ACL ID numbers.
417 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
418 //Get Accountant ACL ID number
419 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
422 //Add new object Sections
423 echo "<BR/><B>Adding new object sections</B><BR/>";
424 // Add 'Groups' object (added in 5.0.1)
425 AclExtended::addObjectSectionAcl('groups', 'Groups');
428 //Add new Objects
429 echo "<BR/><B>Adding new objects</B><BR/>";
430 // Add 'Multipledb' object (added in 5.0.1)
431 AclExtended::addObjectAcl('admin', 'Administration', 'multipledb', 'Multipledb');
432 AclExtended::addObjectAcl('groups', 'Groups', 'gadd', 'View/Add/Update groups');
433 AclExtended::addObjectAcl('groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar');
434 AclExtended::addObjectAcl('groups', 'Groups', 'glog', 'Group encounter log');
435 AclExtended::addObjectAcl('groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record');
436 AclExtended::addObjectAcl('groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist');
437 //Update already existing Objects
438 echo "<BR/><B>Upgrading objects</B><BR/>";
440 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
441 // (will also place in the appropriate group and CREATE a new group if needed)
442 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
444 //Update the ACLs
445 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
446 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gadd', 'View/Add/Update groups', 'write');
447 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
448 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
449 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record', 'write');
450 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist', 'write');
451 //Insert the 'Multipledb' object from the 'admin' section into the Administrators group write ACL (added in 5.0.1)
452 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'multipledb', 'Multipledb', 'write');
453 //DONE with upgrading to this version
454 $acl_version = $upgrade_acl;
457 // Upgrade for acl_version 6
458 $upgrade_acl = 6;
459 if ($acl_version < $upgrade_acl) {
460 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
462 //Collect the ACL ID numbers.
463 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
464 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
465 $doc_write = AclExtended::getAclIdNumber('Physicians', 'write');
466 $clin_addonly = AclExtended::getAclIdNumber('Clinicians', 'addonly');
467 $clin_write = AclExtended::getAclIdNumber('Clinicians', 'write');
468 $front_view = AclExtended::getAclIdNumber('Front Office', 'view');
469 $front_write = AclExtended::getAclIdNumber('Front Office', 'write');
470 $back_view = AclExtended::getAclIdNumber('Accounting', 'view');
471 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
473 //Add new object Sections
474 echo "<BR/><B>Adding new object sections</B><BR/>";
475 AclExtended::addObjectAcl('admin', 'Administration', 'menu', 'Menu');
477 //Add new Objects
478 echo "<BR/><B>Adding new objects</B><BR/>";
480 //Update already existing Objects
481 echo "<BR/><B>Upgrading objects</B><BR/>";
483 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
484 // (will also place in the appropriate group and CREATE a new group if needed)
485 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
487 //Update the ACLs
488 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
489 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'menu', 'Menu', 'write');
491 AclExtended::updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
492 AclExtended::updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
493 AclExtended::updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
494 AclExtended::updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
496 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
497 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
498 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
499 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
500 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
501 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
502 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
504 AclExtended::updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
505 AclExtended::updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
506 AclExtended::updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
507 AclExtended::updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
509 AclExtended::updateAcl($doc_write, 'Physicians', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
510 AclExtended::updateAcl($doc_write, 'Physicians', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
512 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'addonly');
513 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'addonly');
514 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'addonly');
515 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'addonly');
516 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'addonly');
517 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'addonly');
518 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'addonly');
520 AclExtended::updateAcl($clin_write, 'Clinicians', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
521 AclExtended::updateAcl($clin_write, 'Clinicians', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
523 AclExtended::updateAcl($front_view, 'Front Office', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'view');
525 AclExtended::updateAcl($front_write, 'Front Office', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
527 AclExtended::updateAcl($back_view, 'Accounting', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'view');
529 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'multipledb', 'Multipledb', 'write');
530 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'menu', 'Menu', 'write');
531 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
532 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
533 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
534 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
535 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
536 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
537 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
538 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
539 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
540 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
541 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
542 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gadd', 'View/Add/Update groups', 'write');
543 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
544 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
545 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record', 'write');
546 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist', 'write');
548 //DONE with upgrading to this version
549 $acl_version = $upgrade_acl;
553 // Upgrade for acl_version 7
554 $upgrade_acl = 7;
555 if ($acl_version < $upgrade_acl) {
556 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
558 //Collect the ACL ID numbers.
559 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
560 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
561 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
563 //Add new object Sections
564 echo "<BR/><B>Adding new object sections</B><BR/>";
565 AclExtended::addObjectAcl('admin', 'Administration', 'manage_modules', 'Manage modules');
567 //Add new Objects
568 echo "<BR/><B>Adding new objects</B><BR/>";
570 //Update already existing Objects
571 echo "<BR/><B>Upgrading objects</B><BR/>";
573 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
574 // (will also place in the appropriate group and CREATE a new group if needed)
575 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
576 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'manage_modules', 'Manage modules', 'write');
577 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'manage_modules', 'Manage modules', 'write');
579 //Update the ACLs
580 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
582 //DONE with upgrading to this version
583 $acl_version = $upgrade_acl;
586 // Upgrade for acl_version 8
587 $upgrade_acl = 8;
588 if ($acl_version < $upgrade_acl) {
589 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
591 //Collect the ACL ID numbers.
592 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
593 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
594 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
596 //Add new object Sections
597 echo "<BR/><B>Adding new object sections</B><BR/>";
598 AclExtended::addObjectAcl('patients', 'Patients', 'docs_rm', 'Documents Delete');
600 //Add new Objects
601 echo "<BR/><B>Adding new objects</B><BR/>";
603 //Update already existing Objects
604 echo "<BR/><B>Upgrading objects</B><BR/>";
606 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
607 // (will also place in the appropriate group and CREATE a new group if needed)
608 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
609 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'docs_rm', 'Documents Delete', 'write');
610 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs_rm', 'Documents Delete', 'write');
613 //Update the ACLs
614 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
616 //DONE with upgrading to this version
617 $acl_version = $upgrade_acl;
620 // Upgrade for acl_version 9
621 $upgrade_acl = 9;
622 if ($acl_version < $upgrade_acl) {
623 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
625 //Collect the ACL ID numbers.
626 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
627 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
628 $accounting_view = AclExtended::getAclIdNumber('Accounting', 'view');
629 $clinicians_view = AclExtended::getAclIdNumber('Clinicians', 'view');
630 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
631 $frontoffice_view = AclExtended::getAclIdNumber('Front Office', 'view');
632 $physicians_view = AclExtended::getAclIdNumber('Physicians', 'view');
634 //Add new object Sections
635 echo "<BR/><B>Adding new object sections</B><BR/>";
637 //Add new Objects
638 echo "<BR/><B>Adding new objects</B><BR/>";
639 AclExtended::addObjectAcl('patients', 'Patients', 'pat_rep', 'Patient Report');
641 //Update already existing Objects
642 echo "<BR/><B>Upgrading objects</B><BR/>";
644 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
645 // (will also place in the appropriate group and CREATE a new group if needed)
646 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
647 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'write');
648 AclExtended::updateAcl($accounting_view, 'Accounting', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
649 AclExtended::updateAcl($clinicians_view, 'Clinicians', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
650 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'write');
651 AclExtended::updateAcl($frontoffice_view, 'Front Office', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
652 AclExtended::updateAcl($physicians_view, 'Physicians', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
654 //Update the ACLs
655 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
657 //DONE with upgrading to this version
658 $acl_version = $upgrade_acl;
661 // Upgrade for acl_version 10
662 $upgrade_acl = 10;
663 if ($acl_version < $upgrade_acl) {
664 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
666 //Collect the ACL ID numbers.
667 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
668 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
669 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
671 //Add new object Sections
672 echo "<BR/><B>Adding new object sections</B><BR/>";
673 AclExtended::addObjectSectionAcl('inventory', 'Inventory');
675 //Add new Objects
676 echo "<BR/><B>Adding new objects</B><BR/>";
677 AclExtended::addObjectAcl('inventory', 'Inventory', 'lots', 'Lots');
678 AclExtended::addObjectAcl('inventory', 'Inventory', 'sales', 'Sales');
679 AclExtended::addObjectAcl('inventory', 'Inventory', 'purchases', 'Purchases');
680 AclExtended::addObjectAcl('inventory', 'Inventory', 'transfers', 'Transfers');
681 AclExtended::addObjectAcl('inventory', 'Inventory', 'adjustments', 'Adjustments');
682 AclExtended::addObjectAcl('inventory', 'Inventory', 'consumption', 'Consumption');
683 AclExtended::addObjectAcl('inventory', 'Inventory', 'destruction', 'Destruction');
684 AclExtended::addObjectAcl('inventory', 'Inventory', 'reporting', 'Reporting');
686 //Update already existing Objects
687 echo "<BR/><B>Upgrading objects</B><BR/>";
688 //Rename "Pharmacy Dispensary" to "Inventory Administration".
689 AclExtended::editObjectAcl('admin', 'Administration', 'drugs', 'Inventory Administration', 10);
691 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
692 // (will also place in the appropriate group and CREATE a new group if needed)
693 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
695 //Update the ACLs
696 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
697 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'lots', 'Lots', 'write');
698 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'sales', 'Sales', 'write');
699 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'purchases', 'Purchases', 'write');
700 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'transfers', 'Transfers', 'write');
701 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'adjustments', 'Adjustments', 'write');
702 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'consumption', 'Consumption', 'write');
703 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'destruction', 'Destruction', 'write');
704 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'reporting', 'Reporting', 'write');
705 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'lots', 'Lots', 'write');
706 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'sales', 'Sales', 'write');
707 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'purchases', 'Purchases', 'write');
708 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'transfers', 'Transfers', 'write');
709 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'adjustments', 'Adjustments', 'write');
710 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'consumption', 'Consumption', 'write');
711 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'destruction', 'Destruction', 'write');
712 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'reporting', 'Reporting', 'write');
714 //DONE with upgrading to this version
715 $acl_version = $upgrade_acl;
718 // Upgrade for acl_version 11
719 $upgrade_acl = 11;
720 if ($acl_version < $upgrade_acl) {
721 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
723 //Collect the ACL ID numbers.
724 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
725 $clin_write = AclExtended::getAclIdNumber('Clinicians', 'write');
727 //Add new object Sections
728 echo "<BR/><B>Adding new object sections</B><BR/>";
730 //Add new Objects
731 echo "<BR/><B>Adding new objects</B><BR/>";
733 //Update already existing Objects
734 echo "<BR/><B>Upgrading objects</B><BR/>";
736 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
737 // (will also place in the appropriate group and CREATE a new group if needed)
738 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
740 //Update the ACLs
741 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
742 AclExtended::updateAcl($clin_write, 'Clinicians', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
743 AclExtended::updateAcl($clin_write, 'Clinicians', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
745 //DONE with upgrading to this version
746 $acl_version = $upgrade_acl;
749 // Upgrade for acl_version 12
750 $upgrade_acl = 12;
751 if ($acl_version < $upgrade_acl) {
752 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
754 //Collect the ACL ID numbers.
755 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
756 $accounting_view = AclExtended::getAclIdNumber('Accounting', 'view');
757 $frontoffice_view = AclExtended::getAclIdNumber('Front Office', 'view');
758 $frontoffice_write = AclExtended::getAclIdNumber('Front Office', 'write');
760 //Add new object Sections
761 echo "<BR/><B>Adding new object sections</B><BR/>";
763 //Add new Objects
764 echo "<BR/><B>Adding new objects</B><BR/>";
766 //Update already existing Objects
767 echo "<BR/><B>Upgrading objects</B><BR/>";
769 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
770 // (will also place in the appropriate group and CREATE a new group if needed)
771 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
773 //Update the ACLs
774 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
775 AclExtended::shiftAcl($accounting_view, 'Accounting', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
776 AclExtended::shiftAcl($frontoffice_view, 'Front Office', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
777 AclExtended::shiftAcl($frontoffice_write, 'Front Office', 'patients', 'Patients', 'trans', 'Transactions (write,wsome optional)', 'write');
778 AclExtended::shiftAcl($frontoffice_write, 'Front Office', 'patients', 'Patients', 'notes', 'Patient Notes (write,wsome optional)', 'write');
781 //DONE with upgrading to this version
782 $acl_version = $upgrade_acl;
785 /* This is a template for a new revision, when needed
786 // Upgrade for acl_version 13
787 $upgrade_acl = 13;
788 if ($acl_version < $upgrade_acl) {
789 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
791 //Collect the ACL ID numbers.
792 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
794 //Add new object Sections
795 echo "<BR/><B>Adding new object sections</B><BR/>";
797 //Add new Objects
798 echo "<BR/><B>Adding new objects</B><BR/>";
800 //Update already existing Objects
801 echo "<BR/><B>Upgrading objects</B><BR/>";
803 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
804 // (will also place in the appropriate group and CREATE a new group if needed)
805 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
807 //Update the ACLs
808 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
810 //DONE with upgrading to this version
811 $acl_version = $upgrade_acl;
815 //All done
816 AclExtended::setAclVersion($acl_version);
817 echo "DONE upgrading access controls";