ERROR #5883: Item '%Test' is mapped from a database that you do not have write permission on
I have a local testing environment using VSCode.
I'm trying to create a routine %Test.mac, but keep getting permission error.
I have enabled write permissions to percent globals in the Admin Portal.
I'm connecting to Iris with superuser.
How do I give myself permissions?
Thanks
Comments
Hello @Jonathan Perry
The rules for routine name /Class name is "If you start a routine name with %, use z or Z as the next character after that" So, You have to create routine in the name of %zTest/%ZTest
Every routine, class or global that start with "%" is mapped to a system database, usually "%SYS".
In your case %Test.mac is (by default) mapped to the %SYS database.
It seems that you (the user you connect to IRIS) don't have permissions to write to the %SYS database.
Please note that during IRIS upgrade all routines starting with "%" are DELETED, unless they start with %z or %Z, so I suggest to use a different name or, better, create your code in other namespace/database with consistent naming (package name) and map it from your application namespaces. If you need your code in all namespaces, create a mapping for the %ALL (pseudo) namespace.
I'm connected with superuser, which should have permissions on %SYS no?
How to I give permissions to superuser on %SYS database.
What namespace are you logged when you try to create that routine?
Maybe in your namespace the %Test (or %Test*, or...) is mapped to a read only database?
Otherwise you think you are authenticated as superuser but in fact you are not.
It's not a permission issue!
A simple check tells you:
write ##class(%SYS.Namespace).GetRoutineDest(,"%Test") --> ^/opt/isc/icindy/mgr/irislib/
a routine named %Test will bes stored in the "irislib" database.
Now, if you take a look at the irislib database, you will see, it's a READONLY database, hence you get the <PROTECT> error. A readonly means read only, even for the Superuser!
If you absolutely need to name that routine with %-something (except %Z* and %z*) than:
- 1) remove the readonly flag from the database in question
2) save your routine
3) turn on the readonly flag
4) for every change in that routine repeat the abowe game: 1), 2) and 3)
- and don't forget to make a copy of your %-something routine
because each IRIS update REMOVES ALL %-routines except those %Z* and %z*