Merge branch 'dev' into gruppDM

This commit is contained in:
Davenludd 2024-04-15 11:45:28 +02:00
commit 5033b657a4

View file

@ -32,17 +32,12 @@ func GetStatistics(c *fiber.Ctx) error {
return c.Status(500).SendString(err.Error()) return c.Status(500).SendString(err.Error())
} }
if userNameParam == "" { // Bail if the user is not a PM or checking its own statistics
userNameParam = username if !pm && userNameParam != "" && userNameParam != username {
}
if !pm || userNameParam != username {
log.Info("Unauthorized access for user: ", username, "trying to access project: ", projectName, "statistics for user: ", userNameParam) log.Info("Unauthorized access for user: ", username, "trying to access project: ", projectName, "statistics for user: ", userNameParam)
return c.Status(403).SendString("Unauthorized access") return c.Status(403).SendString("Unauthorized access")
} }
username = userNameParam
// Retrieve statistics for the project from the database // Retrieve statistics for the project from the database
statistics, err := db.GetDb(c).ReportStatistics(username, projectName) statistics, err := db.GetDb(c).ReportStatistics(username, projectName)
if err != nil { if err != nil {