/** * Update role permissions */ function update_role_permissions($mode, $sub) { //Standard Admin Role update_role_permissions('grant', 'ROLE_ADMIN_STANDARD', array('a_garage_update', 'a_garage_setting', 'a_garage_business', 'a_garage_category', 'a_garage_field', 'a_garage_model', 'a_garage_product', 'a_garage_quota', 'a_garage_tool', 'a_garage_track'), ACL_YES); //Full Admin Role update_role_permissions('grant', 'ROLE_ADMIN_FULL', array('a_garage_update', 'a_garage_setting', 'a_garage_business', 'a_garage_category', 'a_garage_field', 'a_garage_model', 'a_garage_product', 'a_garage_quota', 'a_garage_tool', 'a_garage_track'), ACL_YES); //Queue Moderator Role update_role_permissions('grant', 'ROLE_MOD_QUEUE', array('m_garage_approve_vehicle', 'm_garage_approve_make', 'm_garage_approve_model', 'm_garage_approve_business', 'm_garage_approve_quartermile', 'm_garage_approve_dynorun', 'm_garage_approve_guestbook', 'm_garage_approve_lap', 'm_garage_approve_track', 'm_garage_approve_product'), ACL_YES); //Standard Moderator Role update_role_permissions('grant', 'ROLE_MOD_STANDARD', array('m_garage_edit', 'm_garage_delete', 'm_garage_rating', 'm_garage_approve_vehicle', 'm_garage_approve_make', 'm_garage_approve_model', 'm_garage_approve_business', 'm_garage_approve_quartermile', 'm_garage_approve_dynorun', 'm_garage_approve_guestbook', 'm_garage_approve_lap', 'm_garage_approve_track', 'm_garage_approve_product'), ACL_YES); //Full Moderator Role update_role_permissions('grant', 'ROLE_MOD_FULL', array('m_garage_edit', 'm_garage_delete', 'm_garage_rating', 'm_garage_approve_vehicle', 'm_garage_approve_make', 'm_garage_approve_model', 'm_garage_approve_business', 'm_garage_approve_quartermile', 'm_garage_approve_dynorun', 'm_garage_approve_guestbook', 'm_garage_approve_lap', 'm_garage_approve_track', 'm_garage_approve_product'), ACL_YES); //Standard Features User Role update_role_permissions('grant', 'ROLE_USER_STANDARD', array('u_garage_browse', 'u_garage_search', 'u_garage_add_vehicle', 'u_garage_delete_vehicle', 'u_garage_add_modification', 'u_garage_delete_modification', 'u_garage_add_quartermile', 'u_garage_delete_quartermile', 'u_garage_add_lap', 'u_garage_delete_lap', 'u_garage_add_track', 'u_garage_delete_track', 'u_garage_add_dynorun', 'u_garage_delete_dynorun', 'u_garage_add_insurance', 'u_garage_delete_insurance', 'u_garage_add_service', 'u_garage_delete_service', 'u_garage_add_blog', 'u_garage_delete_blog', 'u_garage_add_business', 'u_garage_add_make_model', 'u_garage_add_product', 'u_garage_rate', 'u_garage_comment', 'u_garage_upload_image', 'u_garage_remote_image', 'u_garage_delete_image', 'u_garage_deny'), ACL_YES); //All Features User Role update_role_permissions('grant', 'ROLE_USER_FULL', array('u_garage_browse', 'u_garage_search', 'u_garage_add_vehicle', 'u_garage_delete_vehicle', 'u_garage_add_modification', 'u_garage_delete_modification', 'u_garage_add_quartermile', 'u_garage_delete_quartermile', 'u_garage_add_lap', 'u_garage_delete_lap', 'u_garage_add_track', 'u_garage_delete_track', 'u_garage_add_dynorun', 'u_garage_delete_dynorun', 'u_garage_add_insurance', 'u_garage_delete_insurance', 'u_garage_add_service', 'u_garage_delete_service', 'u_garage_add_blog', 'u_garage_delete_blog', 'u_garage_add_business', 'u_garage_add_make_model', 'u_garage_add_product', 'u_garage_rate', 'u_garage_comment', 'u_garage_upload_image', 'u_garage_remote_image', 'u_garage_delete_image', 'u_garage_deny'), ACL_YES); }
echo "<input type=\"button\" class=\"button\" value=\"Refresh\" onclick=\"this.form['op'].value='edit'; this.form.submit();\">"; echo "\n<input type=\"button\" class=\"button\" value=\"Update\" onclick=\"this.form['op'].value='update'; this.form.submit();\">"; echo "</form>"; } if ($HTTP_VARS['op'] == 'update') { $results = fetch_role_permission_rs($HTTP_VARS['role_name']); $defined_permissions_r = array(); if ($results) { while ($permission_r = db_fetch_assoc($results)) { if (isset($HTTP_VARS[$permission_r['permission_name']]) && is_array($HTTP_VARS[$permission_r['permission_name']])) { $perm_r = $HTTP_VARS[$permission_r['permission_name']]; $defined_permissions_r[$permission_r['permission_name']] = array('enabled_ind' => isset($perm_r['enabled_ind']) ? $perm_r['enabled_ind'] : 'N', 'remember_me_ind' => isset($perm_r['remember_me_ind']) ? $perm_r['remember_me_ind'] : 'N'); } } } update_role_permissions($HTTP_VARS['role_name'], $defined_permissions_r); $HTTP_VARS['op'] = 'edit'; } if ($HTTP_VARS['op'] == 'edit') { echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}\">Back to Main</a>]</p>"; echo "\n<h3>Edit {$HTTP_VARS['role_name']} Role Permissions</h3>"; if (is_not_empty_array($errors)) { echo format_error_block($errors); } display_role_permissions_editor($HTTP_VARS); } else { if ($HTTP_VARS['op'] == '') { if (is_not_empty_array($errors)) { echo format_error_block($errors); } // list languages and options