KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Academy KX Advanced Capstone – Authorization Issue

  • KX Advanced Capstone – Authorization Issue

    Posted by ciaranodonnaile on July 18, 2023 at 12:00 am

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

     

     

     

    ciaranodonnaile replied 9 months, 3 weeks ago 3 Members · 5 Replies
  • 5 Replies
  • Laura

    Administrator
    July 19, 2023 at 12:00 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

  • ab

    Member
    July 31, 2023 at 12:00 am

    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

    Administrator
    July 31, 2023 at 12:00 am

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

  • ab

    Member
    July 31, 2023 at 12:00 am

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

     

     

  • Laura

    Administrator
    August 4, 2023 at 12:00 am

    Hi  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.

Log in to reply.