Statistics
This commit is contained in:
		
							parent
							
								
									b51a00b723
								
							
						
					
					
						commit
						a3f16e713a
					
				
					 1 changed files with 3 additions and 8 deletions
				
			
		|  | @ -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 { | ||||||
| 	} | 		log.Info("Unauthorized access for user: ", username, "trying to access project: ", projectName, "statistics for user: ", userNameParam) | ||||||
| 
 |  | ||||||
| 	if !pm || userNameParam != username { |  | ||||||
| 		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 { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus