Changed GetUserProjects so that you have to get username from params. Now admin can choose a user and see what projects the user belongs to
This commit is contained in:
		
							parent
							
								
									218b0b3ab7
								
							
						
					
					
						commit
						85795f5406
					
				
					 2 changed files with 6 additions and 5 deletions
				
			
		|  | @ -44,10 +44,11 @@ func (gs *GState) DeleteProject(c *fiber.Ctx) error { | |||
| 
 | ||||
| // GetUserProjects returns all projects that the user is a member of | ||||
| func (gs *GState) GetUserProjects(c *fiber.Ctx) error { | ||||
| 	// First we get the username from the token | ||||
| 	user := c.Locals("user").(*jwt.Token) | ||||
| 	claims := user.Claims.(jwt.MapClaims) | ||||
| 	username := claims["name"].(string) | ||||
| 	username := c.Params("username") | ||||
| 	if username == "" { | ||||
| 		log.Info("No username provided") | ||||
| 		return c.Status(400).SendString("No username provided") | ||||
| 	} | ||||
| 
 | ||||
| 	// Then dip into the database to get the projects | ||||
| 	projects, err := gs.Db.GetProjectsForUser(username) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Peter KW
						Peter KW