Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add support for specifying a singular admin id to workaround GetIntSlice issue

Andy55cd084ea881
diff --git a/server/pkg/middleware/auth.go b/server/pkg/middleware/auth.go
index 81a9f85f97..9b5797cc98 100644
--- a/server/pkg/middleware/auth.go
+++ b/server/pkg/middleware/auth.go
@@ -93,6 +93,12 @@ func (m *AuthMiddleware) AdminAuthMiddleware() gin.HandlerFunc {
}
// if no admins are set, then check if the user is first user in the system
if len(admins) == 0 {
+ // Fallback for specifying a singular admin ID when encountering https://github.com/spf13/viper/issues/1611
+ if viper.GetInt("internal.admin") == userId {
+ c.Next()
+ return
+ }
+
id, err := m.UserAuthRepo.GetMinUserID()
if err != nil && id == userID {
c.Next()