Hi Guys Do you know where all the Server Admin se...
# lucee
c
Hi Guys Do you know where all the Server Admin settings are stored. Are they put into a MySQL DB, somewhere? The reason I ask , is because we have 600 DSNs which I have successfully imported using:
Copy code
ConfigImport()
The problem is, it doesn't seem to record any of these settings:
Copy code
"allowAlter":true,
"allowCreate":true,
"allowDelete":true,
"allowDrop":true,
"allowGrant":false,
"allowInsert":true,
"allowRevoke":false,
"allowSelect":true,
"allowStoredProcs":true,
"allowUpdate":true,
All these settings are TRUE in the Server Admin I want to go into the DB and change them. I don't fancy having to manually change 600 DSNs manually across 6 PRE PROD/PROD boxes. UPDATE: I have actually found the DSNs in:
Copy code
lucee-server.xml
But, there are no Allowed Operations attributes in the
<data-source>
node? And when we run some of the databases, the connections fail. After we manually set REVOKE/GRANT to FALSE, the connections succeed. It seems that by default, all these operations are set to TRUE, which doesn't seem to agree with: https://github.com/lucee/Lucee/blob/3a563f215bc6060f0410a36099f5310300f0cf75/core/[…]c/main/java/resource/component/org/lucee/cfml/Administrator.cfc When I manually change the values of REVOKE/GRANT in the Lucee Server Admin to FALSE, and I check the XML in:
Copy code
lucee-server.xml
There is no mention of REVOKE/GRANT anywhere? So Lucee must be storing this data in a Database somewhere?
z
the only storage is in the xml file, there's no database involved. most likely the configImport command doesn't yet support those options
c
Can I use: https://github.com/lucee/Lucee/blob/3a563f215bc6060f0410a36099f5310300f0cf75/core/[…]c/main/java/resource/component/org/lucee/cfml/Administrator.cfc
UpdateDatasource()
instead, to add the Allowed Operations? It seems that if I run this method:
Copy code
<cfadmin action="updateDatasource" name="" type="" newName="" host="" database="" port="" username="" password="" allowedRevoke="false" allowedGrant="false" />
That might work?
z
yep, it's all using the same functions, just that configImport needs to be updated, can you file a bug?
πŸ‘ 1
a sample config (w/o password hehe) always helps πŸ™‚
πŸ™‚ 1
c
The weird thing is that Lucee doesn't seem to store the Allowed Operations anywhere, but the checkboxes in the Lucee Server Admin reflect the state, correctly? So, where are they reading the values from?
z
@pothys-mitrahsoft?
c
Unless the
Allowed Operations
values are stored in the Application scope? Which seems a bit ropey? But you can only change the values manually, using the GUI. If I can find out where the raw values are being stored, I may be able to change 600 values more easily, using find/replace with regex etc
z
no it's only stored in the xml.
admin just updates the xml file
c
I promise you the A*llowed Operation* values are not stored in the XML. I have checked very methodically, once I changed the values via the GUI
lucee-server.xml
p
@zackster yup, the A*llowed Operation* values not stored in lucee-server.xml file
πŸ‘ 1
c
Do you know where they are stored?
z
allow="511" is this bit packed?
πŸ”₯ 1
c
Yes. I see allow=β€œ511” in lucee-server.xml data source XML node
How is that related to Allowed Operations
c
Why has it been done like this? Why not just have an attribute called
grant=β€œfalse”
or
revoke=β€œtrue”
. It’s not very intuitive?
z
it's old skool n faster, anyway that's how it is
what does cfconfig export?
c
Do you know what value for all true, except for revoke & grant?
cfconfig:
Copy code
"allowAlter":true,
"allowCreate":true,
"allowDelete":true,
"allowDrop":true,
"allowGrant":false,
"allowInsert":true,
"allowRevoke":false,
"allowSelect":true,
Well, this is what I was importing into ConfigImport()
z
the logic in the last link from pothys does some bit bashing with these values https://github.com/lucee/Lucee/blob/5.3/loader/src/main/java/lucee/runtime/db/DataSource.java#L40
πŸ‘ 1
long and short, configImport needs to support the exploded / human friendly format
int allow = (getBoolV("allowed_select", false) ? DataSource.ALLOW_SELECT : 0) + (getBoolV("allowed_insert", false) ? DataSource.ALLOW_INSERT : 0) + (getBoolV("allowed_update", false) ? DataSource.ALLOW_UPDATE : 0) + (getBoolV("allowed_delete", false) ? DataSource.ALLOW_DELETE : 0) + (getBoolV("allowed_alter", false) ? DataSource.ALLOW_ALTER : 0) + (getBoolV("allowed_drop", false) ? DataSource.ALLOW_DROP : 0) + (getBoolV("allowed_revoke", false) ? DataSource.ALLOW_REVOKE : 0) + (getBoolV("allowed_grant", false) ? DataSource.ALLOW_GRANT : 0) + (getBoolV("allowed_create", false) ? DataSource.ALLOW_CREATE : 0); if (allow == 0) allow = DataSource.ALLOW_ALL;
c
OK. I understand now...
So I need to swap:
Copy code
allow="511"
For:
Copy code
allow="415"
Well, that will save me about 5 days work...πŸ™‚
πŸ‘ 1
z
c
Do I have to restart Lucee, if I change
lucee-server.xml
It works. Great stuff! Thanks for your help...
z
lucee checks for updates every 60s i think
πŸ‘ 1
@Charles Robertson as i saved you 5 days, could you test this out for me?
added some tests, fixed some bugs, test pass, give this a go (drop it in your lucee-server/deploy directory
πŸ‘ 1
c
I will do this, either this evening or tomorrow, as we have to deploy our
ACF -> Lucee
fixes to production, very soon. Tight schedule. I will let you know the results... Thank you for fixing this. πŸ™
Actually, I will test this today πŸ™‚
I am using an existing CommandBox server. Can I just install the update via the Lucee Server Admin?
z
no, it's not merged, you you need to drop it into the deploy folder
c
In CommandBox, once I have dropped the snapshot into:
Copy code
C:\Users\ADMCharlesr\.CommandBox\server\F52F378669CF969E685912784C2D3D37-luceeCfconfigTest\lucee-5.3.9.166\WEB-INF\lucee-server\deploy
Should I restart the server or do I need to install the snapshot via the Lucee Server admin:
z
it should automatically pick it up within 60s
c
So this looks correct?
z
perfect
c
OK. Here we go...
It works! Great stuff... Cheers πŸ™
z
wooohooo, thanks for testing!
πŸ‘ 1
c
No worries. My team will be very pleased...πŸ™‚
z
can you comment on the ticket, if you haven't already?
πŸ‘ 1
(in a meeting)
c
I am not sure whether this is relevant to your fix, but I did get an error when it tried to insert a MSSQL DSN All the PostGreSQL DSN were successfully added, but 268 MSSQL were not added? Now this may be because I was trying to add PRE PROD DSNs in a Dev environment, or it maybe that I don't have the correct driver? But I thought I should mention this, even though your fixed worked for 5 DSNs...
z
diff problem
new thread plz
c
Yes. That's what I thought... That's why I didn't mention, it immediately...
I think I need to add the correct driver to:
Copy code
C:\Users\ADMCharlesr\.CommandBox\server\A39A87EE2EFB28FAFA02EAB99EA6149F-system_learningassistant_lucee\lucee-5.3.9.166\WEB-INF\lucee-server\bundles
Actually, I swapped:
com.microsoft.jdbc.sqlserver.SQLServerDriver
For
com.microsoft.sqlserver.jdbc.SQLServerDriver
And everything worked...πŸ™‚
tests pass, manual confirmed, merged as 5.3.10.139
❀️ 2
πŸ™ 1