@@ -3,7 +3,6 @@ package handlers
33import (
44 "encoding/json"
55 "errors"
6- "expo-open-ota/config"
76 "expo-open-ota/internal/handlers"
87 "expo-open-ota/internal/middleware"
98 "expo-open-ota/internal/services"
@@ -95,19 +94,15 @@ func renderUserServiceError(w http.ResponseWriter, err error) {
9594}
9695
9796// GetMeHandler answers with the account behind the current session. In
98- // control-plane mode the row is re-read so the dashboard sees a revoked admin
99- // flag on its next load, not at token refresh.
97+ // control-plane mode the service re-reads the row so the dashboard sees a
98+ // revoked admin flag on its next load, not at token refresh.
10099func (h * UsersHandler ) GetMeHandler (w http.ResponseWriter , r * http.Request ) {
101100 principal := middleware .PrincipalFromContext (r .Context ())
102101 if principal == nil {
103102 handlers .RenderError (w , http .StatusUnauthorized , "This route requires a dashboard session" )
104103 return
105104 }
106- if ! config .IsDBMode () {
107- renderJSON (w , http .StatusOK , UserResponse {Email : principal .Email , IsAdmin : true , Enabled : true })
108- return
109- }
110- user , err := h .userService .GetUserByID (r .Context (), principal .UserId )
105+ user , err := h .userService .GetMe (r .Context (), principal .UserId , principal .Email )
111106 if err != nil {
112107 // Only a missing row means the session is a leftover of a deleted
113108 // account; an infrastructure failure must not read as a dead session.
0 commit comments