kentonh / gPanel

A web-hosting control panel written in Go.
MIT License
80 stars 25 forks source link

User API Blackboxing Functions #61

Closed george-e-shaw-iv closed 6 years ago

george-e-shaw-iv commented 6 years ago

Severity level (1-10):

7

Files/Directories Involved:

pkg/api/user/*

Description:

The functions use two struct vars that are accessible in the package scope and they manipulate them in the package scope. I can already forsee a problem of two functions being called at relatively the same time and trying to manipulate those structs at the same time, resulting in lost data. So that needs to be addressed accordingly.

Personal Comments:

I don't know why I designed it that way in the first place..

george-e-shaw-iv commented 6 years ago

The easiest thing to probably do is to just copy and paste those structs inside of the functions that use them and then just get rid of the file that contained them initially (pkg/api/user/user.go) as we wouldn't need it at that point.

george-e-shaw-iv commented 6 years ago

For reference look at the way pkg/api/user/shutdown.go handles request data.