fix
This commit is contained in:
@@ -69,11 +69,25 @@ func (s *Server) handleAdminCloneCompanyCatalog(w http.ResponseWriter, r *http.R
|
||||
ClientOrLog(w, http.StatusBadRequest, "could not clone catalog", err, catalog.ClientError)
|
||||
return
|
||||
}
|
||||
|
||||
// Point the admin session at the destination so Products / process use the cloned catalog.
|
||||
if s.Sessions != nil {
|
||||
s.Sessions.Put(r.Context(), auth.SessionCompanyIDKey, destID.String())
|
||||
if s.Auth != nil {
|
||||
if uid, ok := UserIDFromContext(r.Context()); ok && uid != uuid.Nil {
|
||||
if _, memErr := s.Auth.EnsureMembership(r.Context(), uid, destID); memErr == nil {
|
||||
s.Sessions.Remove(r.Context(), auth.SessionStaffHomeCompanyKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSON(w, http.StatusOK, map[string]any{
|
||||
"status": "ok",
|
||||
"source_company_id": res.SourceCompanyID,
|
||||
"dest_company_id": res.DestCompanyID,
|
||||
"counts": res.Counts,
|
||||
"active_company_id": destID,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user