Fix for checkProjectManager endpoint and test_check_if_project_manager

This commit is contained in:
Imbus 2024-03-20 17:50:51 +01:00
parent 0017e9b9ef
commit 45761dadcb
3 changed files with 7 additions and 4 deletions

View file

@ -212,8 +212,12 @@ func (gs *GState) AddUserToProjectHandler(c *fiber.Ctx) error {
// IsProjectManagerHandler is a handler that checks if a user is a project manager for a given project
func (gs *GState) IsProjectManagerHandler(c *fiber.Ctx) error {
// Get the username from the token
user := c.Locals("user").(*jwt.Token)
claims := user.Claims.(jwt.MapClaims)
username := claims["name"].(string)
// Extract necessary parameters from the request query string
username := c.Query("username")
projectName := c.Query("projectName")
// Check if the user is a project manager for the specified project