diff --git a/server/acl.go b/server/acl.go index 11c0aba..252a550 100644 --- a/server/acl.go +++ b/server/acl.go @@ -62,7 +62,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc { println("path", path) - if common.HasPrefixes(path, "/api/ping", "/api/status", "/api/user/:id", "/api/workspace/:workspaceName/shortcut/:shortcutName") && c.Request().Method == http.MethodGet { + if common.HasPrefixes(path, "/api/ping", "/api/status", "/api/user/:id") && c.Request().Method == http.MethodGet { return next(c) } @@ -106,6 +106,10 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc { } } + if common.HasPrefixes(path, "/api/workspace/:workspaceName/shortcut/:shortcutName") && c.Request().Method == http.MethodGet { + return next(c) + } + userID := c.Get(getUserIDContextKey()) if userID == nil { return echo.NewHTTPError(http.StatusUnauthorized, "Missing user in session") diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index 51d77ed..697ccd9 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -20,31 +20,37 @@ const Header: React.FC = () => { Corgi
- - {user?.name} - -
- } - actions={ - <> - navigate(`/user/${user?.id}`)} - > - My information - - handleSignOutButtonClick()} - > - Sign out - - - } - actionsClassName="!w-36" - > + {user ? ( + + {user?.name} + + + } + actions={ + <> + navigate(`/user/${user?.id}`)} + > + My information + + handleSignOutButtonClick()} + > + Sign out + + + } + actionsClassName="!w-36" + > + ) : ( + navigate("/auth")}> + Sign in + + )}