add search by username
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-22 16:13:35 +11:00
parent de1a076d64
commit abaa291a14
3 changed files with 31 additions and 2 deletions

View File

@@ -92,6 +92,20 @@ func RetrieveSecretByDevicecategory(c *gin.Context) {
retrieveSpecifiedSecret(&s, c)
}
func RetrieveSecretByUsername(c *gin.Context) {
userName := c.Param("username")
if userName == "" {
c.JSON(http.StatusBadRequest, gin.H{"error": "no username value specified"})
return
}
// Create object based on specified data
s := models.Secret{UserName: userName}
retrieveSpecifiedSecret(&s, c)
}
func retrieveSpecifiedSecret(s *models.Secret, c *gin.Context) {
/*
// Get the user and role id of the requestor