New globals driving me crazy

Wappler 3.5.7
Win 10
PHP

Sorry folks but I seem to be spending all my time trying to get around problems since the new globals were introduced.

The latest is
I have a security provider defined

I have a simple server action

Done this hundreds of times But i am getting: “Security provider is Required”

Have switched experimental on and off a few times,
With E.F. off I get a JSON parse error “Error parsing the JSON in exec”
Also when switching I keep losing the DB connection settings and have to re-input them each time

Hi Brian,
Just enable the experimental features and define your security provider under globals.
Then don’t add security provider as a step in your server action.

Everything defined under globals (database connections, security providers etc) should be directly reused, not added a separate step in the server action …

This is an old site and I have multiple security providers for different functions, how does the SA know which one to use?

Brian, if they are “linked” - i.e. you clicked the link button, they will appear under globals.
So you only need to select them in the dropdown of the restrict step or login step or logout step:

Yes, they all appear in the globals, that was not a problem.
image

I was using a security provider step to allocate the correct provider as there is actually no need for a security restrict as the output would be null if the user was not logged in (that is actually the purpose of the SA)

However removing the security provider stage and using a security restrict in it’s place has cleared the error but i does to me seems a counter intuitive workaround.

What are you trying to do exactly?
Get the identity of the logged user? If that’s the case then don’t use the security restrict …

Use the Security Identify step as explained here:

It will be available in the data picker for all your server actions.

Unfortunately I hit save but the settings do not save

I input

Save

If i refresh the settings are gone

I’ve just tested this and it works fine.
Can you please make sure the experimental features are turned on in the settings and then fully quit and restart Wappler?

OK, restarted and globals now saving

So next stage is I tried a simple login

so we have a basic login action (ignore the set value steps, they are for debugging)

image

I run the action and it’s output is correct

image

I then add a single query to get the record filtered on the returned identity

I get an error (this is a table not a view)

If i change to a standard query i don’t get an error but the query does not return the record, it returns null

image

Well Brian, this is a known bug with views in PHP (in PHP itself not in the PHP extensions) and MySql server version older than 5.7 (many bug reports like this are available )
That’s why we have added the prepared statements option in the database connection options, so that you can enable or disable this option in order to fix this error:

Yes but that issue related of using views?, these are tables not views

Anyway i have re-uploaded the dmxConnectLib folder and that has cleared the error BUT the query is still not returning any data (single or multiple query). Multiple returns an empty set, single returns null

Obviously the record exists as it has just logged in against that record.

The error is caused by the bug in the PHP i mentioned. Set the prepared statements to true and save the database connection for your selected target to fix it.

So is the prepared statements error now fixed?
Does the query return any results if you remove the filter?

Yes, re-uploading the dmxConnectLib folder cleared that, the issue is now that no data is being returned in the query

What if you enter the identity directly as a filter value?

based on single query,
If i remove the filter then the first record in the table is returned as I would expect (which just happens to be the record i am using for testing)

image

If i hard code the record number as a filter then the correct record is returned.

image

If i reference the security id then nothing is returned

image

What happens if you bind the identity in a setvalue step in your server action and enable output? Does it return a value?

Like your thinking, returns Null?

image

So it has the correct value here

but not here?

image

Just set up a quick test locally - one server action for login, global identify step and another action with a setvalue step which uses identify as a value - the identity is properly returned in the setvalue step.

Can you try deleting the dmxConnectLib folder and resave your server action so it can be recreated? Then upload it to your server and test again.

Sorry, same result
image