cancel
Showing results for 
Search instead for 
Did you mean: 

KX Advanced Capstone - Authorization Issue

ciaranodonnaile
New Contributor

I'm having trouble with question 3.6 in the Authorization section. When I run the test script, I pass all but one:

ciaranodonnaile_0-1689707431574.png

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:)

 

 

 

5 REPLIES 5

Laura
Community Manager Community Manager
Community Manager

Hi Ciaran, 

I see that you've got your Advanced Certificate now, congratulations! 

What ended up being the cause of the "sensor" error?

Laura

ab
New Contributor II

@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";};

Laura
Community Manager Community Manager
Community Manager

Hi @ab what is the issue you are having? Is it the same error that Ciaran had above?

ab
New Contributor II

hi yes, I'm facing the exact same problem. Please find the attached ss.

ab_0-1690817917275.png

 

Michaela
Community Manager Community Manager
Community Manager

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.