} } // Set permissions only if supplied if (!empty($function_params['permissions'])) { $user->RevokeAccess(); foreach ($function_params['permissions'] as $area => $p) { foreach ($p as $subarea => $k) { $user->GrantAccess($area, $subarea); } } } // Check if we need to grant extra list access to the user if (isset($function_params['lists'])) { $user->RevokeListAccess(); $access = array(); if (!is_array($function_params['lists'])) { $access[$function_params['lists']] = 1; } else { foreach ($function_params['lists'] as $listid) { $access[$listid] = 1; } } $user->GrantListAccess($access); } // Check if we need to grant extra templates access to the user if (isset($function_params['templates'])) {