Linter fixes and proper error handling in PromoteToPm
This commit is contained in:
parent
7635791f09
commit
1f4abc2a6a
3 changed files with 6 additions and 2 deletions
|
@ -44,6 +44,10 @@ func PromoteToPm(c *fiber.Ctx) error {
|
|||
|
||||
// Add the user to the project with the specified role
|
||||
err = db.GetDb(c).ChangeUserRole(new_pm_name, project, "project_manager")
|
||||
if err != nil {
|
||||
log.Info("Error promoting user to project manager:", err)
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
// Return success message
|
||||
log.Info("User : ", new_pm_name, " promoted to project manager in project: ", project)
|
||||
|
|
|
@ -38,7 +38,7 @@ func GetAllWeeklyReports(c *fiber.Ctx) error {
|
|||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
if pm == false && target_user != username {
|
||||
if pm && target_user != username {
|
||||
log.Info("Unauthorized access")
|
||||
return c.Status(403).SendString("Unauthorized access")
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ func GetWeeklyReport(c *fiber.Ctx) error {
|
|||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
if pm == false && target_user != username {
|
||||
if pm && target_user != username {
|
||||
log.Info("Unauthorized access")
|
||||
return c.Status(403).SendString("Unauthorized access")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue