2023.07.18 12:21 PM
I'm having trouble with question 3.6 in the Authorization section. When I run the test script, I pass all but one:
Looking more closely at the "sensor" error, it seems as if the .fia.getSummaryReport query requires the sensor table to be in memory in the remote process:
hdbH".fia.getSummaryReport[]" gives the same sensor error.
On inspection:
hdbH".fia.getSummaryReport" gives {select count i by date,sensorId from sensor where date=2020.01.02}.
Does this error mean I have defined .z.pg incorrectly or does this question require the loading of the sensor table into the remote process?
Many thanks:)
2023.07.19 03:53 AM
Hi Ciaran,
I see that you've got your Advanced Certificate now, congratulations!
What ended up being the cause of the "sensor" error?
Laura
2023.07.31 02:28 AM
@Laura @ciaranodonnaile can you please help with this question. Pasting the code I have written. Also how to test it locally?
#spoiler
.z.pg:{[msg] user: msg[`user];query: msg[`query]; if[any .perm.users[`user = user; api = "all"]; : value query];firstElem: .perm.parseQuery query;if[any .perm.users[`user = user; api = firstElem]; : value query];"notAuthorized";};
2023.07.31 04:43 AM
Hi @ab what is the issue you are having? Is it the same error that Ciaran had above?
2023.07.31 08:38 AM
hi yes, I'm facing the exact same problem. Please find the attached ss.
2023.08.04 02:49 AM - edited 2023.08.04 02:50 AM
Hi @ab the issue is related to how you are referencing user, you can use .z.u instead.
To help with testing locally you could:
// define 2 handles for 2 seperate users
jmurphyHandle:hopen `::5099:jmurphy:bahrain22
fiaHandle:hopen `::5099:fiauser:getmeallthedata
// user name itself is returned using .z.u
jmurphyHandle".z.u"
fiaHandle".z.u"
// can then check if specific users exist in your permissions table and what APIs they are allowed to call
jmurphyHandle".perm.users[.z.u]"
fiaHandle".perm.users[.z.u][`api]"
You can build up your function bit by bit calling over the handle.
Hope this helps, would recommend the Advanced IPC course for some more practice materials on interacting between multiple processes.
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.