why my script.lua file is not working

My script.lua file contains the following code and i want to stop users from deleting studies

function IncomingHttpRequestFilter(method, uri, ip, username, httpHeaders)
– Only allow GET requests for non-admin users

if username == ‘admin’ then
return false
return true

My orthanc.json file

“LuaScripts” : [ “C:\Orthanc\Script.lua”

and authentication is also enabled

“AuthenticationEnabled” : true,

What do you mean by “not working” ?
Have you tried adding a few print() in your lua script to make sure it’s being called ?
Have you checked in your logs that it is loaded correctly ?

In addition to Alain’s answer, there’s a section about this topic in the Orthanc Book: