mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-16 12:23:12 +00:00
chore: fix acl
This commit is contained in:
parent
469c841713
commit
5c73f6dd00
@ -62,7 +62,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
|
|||||||
|
|
||||||
println("path", path)
|
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)
|
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())
|
userID := c.Get(getUserIDContextKey())
|
||||||
if userID == nil {
|
if userID == nil {
|
||||||
return echo.NewHTTPError(http.StatusUnauthorized, "Missing user in session")
|
return echo.NewHTTPError(http.StatusUnauthorized, "Missing user in session")
|
||||||
|
@ -20,31 +20,37 @@ const Header: React.FC = () => {
|
|||||||
Corgi
|
Corgi
|
||||||
</span>
|
</span>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Dropdown
|
{user ? (
|
||||||
trigger={
|
<Dropdown
|
||||||
<div className="flex flex-row justify-end items-center cursor-pointer">
|
trigger={
|
||||||
<span>{user?.name}</span>
|
<div className="flex flex-row justify-end items-center cursor-pointer">
|
||||||
<Icon.ChevronDown className="ml-1 w-5 h-auto text-gray-600" />
|
<span>{user?.name}</span>
|
||||||
</div>
|
<Icon.ChevronDown className="ml-1 w-5 h-auto text-gray-600" />
|
||||||
}
|
</div>
|
||||||
actions={
|
}
|
||||||
<>
|
actions={
|
||||||
<span
|
<>
|
||||||
className="w-full px-3 leading-8 cursor-pointer rounded whitespace-nowrap hover:bg-gray-100"
|
<span
|
||||||
onClick={() => navigate(`/user/${user?.id}`)}
|
className="w-full px-3 leading-8 cursor-pointer rounded whitespace-nowrap hover:bg-gray-100"
|
||||||
>
|
onClick={() => navigate(`/user/${user?.id}`)}
|
||||||
My information
|
>
|
||||||
</span>
|
My information
|
||||||
<span
|
</span>
|
||||||
className="w-full px-3 leading-8 cursor-pointer rounded whitespace-nowrap hover:bg-gray-100"
|
<span
|
||||||
onClick={() => handleSignOutButtonClick()}
|
className="w-full px-3 leading-8 cursor-pointer rounded whitespace-nowrap hover:bg-gray-100"
|
||||||
>
|
onClick={() => handleSignOutButtonClick()}
|
||||||
Sign out
|
>
|
||||||
</span>
|
Sign out
|
||||||
</>
|
</span>
|
||||||
}
|
</>
|
||||||
actionsClassName="!w-36"
|
}
|
||||||
></Dropdown>
|
actionsClassName="!w-36"
|
||||||
|
></Dropdown>
|
||||||
|
) : (
|
||||||
|
<span className="cursor-pointer" onClick={() => navigate("/auth")}>
|
||||||
|
Sign in
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user