Merge branch 'develop' of https://github.com/pterodactyl/wings into develop

This commit is contained in:
Dane Everitt
2020-12-15 20:20:16 -08:00
3 changed files with 50 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package router
import (
"errors"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/pkg/errors"
@@ -100,6 +101,9 @@ func (m *Middleware) RequireAuthorization() gin.HandlerFunc {
}
// Helper function to fetch a server out of the servers collection stored in memory.
//
// This function should not be used in new controllers, prefer ExtractServer where
// possible.
func GetServer(uuid string) *server.Server {
return server.GetServers().Find(func(s *server.Server) bool {
return uuid == s.Id()