Remove account IDs in favor of just account names

These were a "security" feature but pre-emptive and just add complications when we can implement secrets later
This commit is contained in:
Marc Di Luzio 2020-06-10 18:56:24 +01:00
parent b3b369f608
commit 7749854eb7
8 changed files with 23 additions and 53 deletions

View file

@ -6,7 +6,6 @@ import (
"io"
"net/http"
"github.com/google/uuid"
"github.com/mdiluz/rove/pkg/rove"
"github.com/mdiluz/rove/pkg/version"
)
@ -87,7 +86,7 @@ func HandleRegister(s *Server, vars map[string]string, b io.ReadCloser, w io.Wri
} else if acc, err := s.accountant.RegisterAccount(data.Name); err != nil {
response.Error = err.Error()
} else if _, _, err := s.SpawnRoverForAccount(acc.Id); err != nil {
} else if _, _, err := s.SpawnRoverForAccount(acc.Name); err != nil {
response.Error = err.Error()
} else if err := s.SaveAll(); err != nil {
@ -95,7 +94,6 @@ func HandleRegister(s *Server, vars map[string]string, b io.ReadCloser, w io.Wri
} else {
// Save out the new accounts
response.Id = acc.Id.String()
response.Success = true
}
@ -120,9 +118,6 @@ func HandleCommand(s *Server, vars map[string]string, b io.ReadCloser, w io.Writ
} else if len(id) == 0 {
response.Error = "No account ID provided"
} else if id, err := uuid.Parse(id); err != nil {
response.Error = fmt.Sprintf("Provided account ID was invalid: %s", err)
} else if inst, err := s.accountant.GetRover(id); err != nil {
response.Error = fmt.Sprintf("Provided account has no rover: %s", err)
@ -147,9 +142,6 @@ func HandleRadar(s *Server, vars map[string]string, b io.ReadCloser, w io.Writer
if len(id) == 0 {
response.Error = "No account ID provided"
} else if id, err := uuid.Parse(id); err != nil {
response.Error = fmt.Sprintf("Provided account ID was invalid: %s", err)
} else if inst, err := s.accountant.GetRover(id); err != nil {
response.Error = fmt.Sprintf("Provided account has no rover: %s", err)
@ -179,9 +171,6 @@ func HandleRover(s *Server, vars map[string]string, b io.ReadCloser, w io.Writer
if len(id) == 0 {
response.Error = "No account ID provided"
} else if id, err := uuid.Parse(id); err != nil {
response.Error = fmt.Sprintf("Provided account ID was invalid: %s", err)
} else if inst, err := s.accountant.GetRover(id); err != nil {
response.Error = fmt.Sprintf("Provided account has no rover: %s", err)