function activateReadOnly(){
    // Deactivate save button
    w2ui['toolbar'].disable('file:save_sod');

    // Deal with locks
    w2ui['toolbar'].disable('file:release_lock');
    w2ui['toolbar'].enable('file:request_lock');
    w2ui['toolbar'].enable('file:force_unlock');

    //remove buttons in grids
    w2ui.grd_timeline.toolbar.disable("add","remove","import","export")
    w2ui.grd_investigated_systems.toolbar.disable("add","remove","import","export")
    w2ui.grd_malware.toolbar.disable("add","remove","import","export")
    w2ui.grd_accounts.toolbar.disable("add","remove","import","export")
    w2ui.grd_network.toolbar.disable("add","remove","import","export")
    w2ui.grd_exfiltration.toolbar.disable("add","remove","import","export")
    w2ui.grd_osint.toolbar.disable("add","remove","import","export")
    w2ui.grd_systems.toolbar.disable("add","remove","import","export")
    w2ui.grd_actions.toolbar.disable("add","remove","import","export")
    w2ui.grd_casenotes.toolbar.disable("add","remove","import","export")
    w2ui.grd_investigators.toolbar.disable("add","remove","import","export")
    w2ui.grd_evidence.toolbar.disable("add","remove","import","export")

    //deactivate context menus
    deactivate_all_context_items(w2ui.grd_timeline.menu)
    deactivate_all_context_items(w2ui.grd_investigated_systems.menu)
    deactivate_all_context_items(w2ui.grd_malware.menu)
    deactivate_all_context_items(w2ui.grd_accounts.menu)
    deactivate_all_context_items(w2ui.grd_network.menu)
    deactivate_all_context_items(w2ui.grd_exfiltration.menu)
    deactivate_all_context_items(w2ui.grd_osint.menu)
    deactivate_all_context_items(w2ui.grd_systems.menu)
    deactivate_all_context_items(w2ui.grd_investigators.menu)
    deactivate_all_context_items(w2ui.grd_evidence.menu)
    deactivate_all_context_items(w2ui.grd_actions.menu)
    deactivate_all_context_items(w2ui.grd_casenotes.menu)

    lockstate = "&#128274; Case locked (no edits allowed)"
    $( "#lock" ).html(lockstate)

    //deactivate grid editable

    writeprotect_grid(w2ui.grd_timeline)
    writeprotect_grid(w2ui.grd_investigated_systems)
    writeprotect_grid(w2ui.grd_malware)
    writeprotect_grid(w2ui.grd_accounts)
    writeprotect_grid(w2ui.grd_network)
    writeprotect_grid(w2ui.grd_exfiltration)
    writeprotect_grid(w2ui.grd_osint)
    writeprotect_grid(w2ui.grd_systems)
    writeprotect_grid(w2ui.grd_actions)
    writeprotect_grid(w2ui.grd_casenotes)
    writeprotect_grid(w2ui.grd_investigators)
    writeprotect_grid(w2ui.grd_evidence)

    w2ui.grd_timeline.refresh()
    w2ui.grd_investigated_systems.refresh()
    w2ui.grd_malware.refresh()
    w2ui.grd_accounts.refresh()
    w2ui.grd_network.refresh()
    w2ui.grd_exfiltration.refresh()
    w2ui.grd_osint.refresh()
    w2ui.grd_systems.refresh()
    w2ui.grd_actions.refresh()
    w2ui.grd_casenotes.refresh()
    w2ui.grd_investigators.refresh()
    w2ui.grd_evidence.refresh()
}
Change to GUI to read only mode when the user does not have the lock