sipcapture / homer-app

HOMER 7.x Front-End and API Server
http://sipcapture.io
GNU Affero General Public License v3.0
205 stars 84 forks source link

User cannot update User Settings (home dashboard json) #377

Closed ghmj2417 closed 4 years ago

ghmj2417 commented 4 years ago

I have a user (not an admin) trying to update their user settings (home dashboard) but it is not doing so. We have tried updating the dashboard by updating the json, doesn't work. We have tried deleting the dashboard, doesn't work. Every time we save or try to delete, the same dashboard appears.

I checked the postgresql logs and see the following:

:[26784]:ERROR: invalid input syntax for type uuid: "" :[26784]:STATEMENT: SELECT * FROM "user_settings" WHERE ("user_settings"."guid" = $1) AND ("user_settings"."username" = $2) :[26784]:ERROR: invalid input syntax for type uuid: "" :[26784]:STATEMENT: DELETE FROM "user_settings" WHERE ("user_settings"."guid" = $1) AND ("user_settings"."username" = $2)

Something is up with the User Settings page. The same user can create a new dashboard and delete the newly created dashboard via the main dashboard page (not User Settings page). But their goal is to be able to update the default 'Home' dashboard, not create new dashboards.

ghmj2417 commented 4 years ago

Is this more of a homer-ui or homer-app issue? I can open an issue under homer-ui if that's where it belongs.

adubovikov commented 4 years ago

do you see uuid has been sent ?

ghmj2417 commented 4 years ago

The guid is being sent according to the payload in the browser log. I removed the data values for clarity.

{"category":"dashboard","data":{},"guid":"31dbdb5e-30a2-4040-a180-39f77e9dfe34","id":826,"param":"home","partid":10,"username":"test"}

However, the homer-app logs and postgresql logs show

{"level":"info","module":"gorm","msg":"pq: invalid input syntax for type uuid: \"\"","time":"2020-08-19T14:21:16Z","type":"log"}
{"level":"info","module":"gorm","msg":"SELECT * FROM \"user_settings\"  WHERE (\"user_settings\".\"guid\" = $1) AND (\"user_settings\".\"username\" = $2)","time":"2020-08-19T14:21:16Z","type":"sql"}
{"level":"info","module":"gorm","msg":"pq: invalid input syntax for type uuid: \"\"","time":"2020-08-19T14:21:16Z","type":"log"}
{"level":"info","module":"gorm","msg":"UPDATE \"user_settings\" SET \"category\" = $1, \"create_date\" = $2, \"data\" = $3, \"param\" = $4, \"partid\" = $5, \"username\" = $6  WHERE (\"user_settings\".\"username\" = $7) AND (\"user_settings\".\"guid\" = $8)","time":"2020-08-19T14:21:16Z","type":"sql"}
ghmj2417 commented 4 years ago

Is there any additional information you would like to see?

lmangani commented 4 years ago

@ghmj2417 I think all the info is there, the other element is time :) we'll get to this

adubovikov commented 4 years ago

so, just taken the latest version of homer-app and UI - don't see any issues. How I can reproduce your issue ?

ghmj2417 commented 4 years ago

I am also using the latest homer-app and homer-ui. For our case, login as a non admin, go to Settings / User Settings / edit your 'home' dashboard. Modify the JSON, for example, edit gridType to something different, click Save. Click edit on the 'home' dashboard again. In our case the JSON wasn't updated and the dashboard is using the old values. The errors outlined in this ticket are logged.

I also tested logging in as an admin and trying to make the changes outlined above. I couldn't update any of the dashboards of our users.

adubovikov commented 4 years ago

https://github.com/sipcapture/homer-app/commit/1ca96b3e9dd360a4a674af68166779e4c68dc5ba

please re-test

ghmj2417 commented 4 years ago

Looks good. The changes are being saved now. Thank you!