mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
scenario: minor security fix for access to all scenarios
This commit is contained in:
parent
ebc1ae16b7
commit
601eb746ce
1 changed files with 1 additions and 2 deletions
|
@ -59,7 +59,6 @@ func getScenarios(c *gin.Context) {
|
|||
|
||||
// ATTENTION: do not use c.GetInt (common.UserIDCtx) since user_id is of type uint and not int
|
||||
userID, _ := c.Get(database.UserIDCtx)
|
||||
userRole, _ := c.Get(database.UserRoleCtx)
|
||||
|
||||
var u user.User
|
||||
err := u.ByID(userID.(uint))
|
||||
|
@ -70,7 +69,7 @@ func getScenarios(c *gin.Context) {
|
|||
// get all scenarios for the user who issues the request
|
||||
db := database.GetDB()
|
||||
var scenarios []database.Scenario
|
||||
if userRole == "Admin" { // Admin can see all scenarios
|
||||
if u.Role == "Admin" { // Admin can see all scenarios
|
||||
err = db.Order("ID asc").Find(&scenarios).Error
|
||||
if helper.DBError(c, err) {
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue