gateway: show run/tasks/steps if the project is public
If the project is public don't require the user to be logged in to show the run/tasks/logs
This commit is contained in:
parent
8d67844cc4
commit
5c2bf8642f
|
@ -194,13 +194,13 @@ func (h *ActionHandler) CanGetRun(ctx context.Context, runGroup string) (bool, e
|
||||||
visibility = types.VisibilityPrivate
|
visibility = types.VisibilityPrivate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if visibility == types.VisibilityPublic {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
isProjectMember, err := h.IsProjectMember(ctx, ownerType, ownerID)
|
isProjectMember, err := h.IsProjectMember(ctx, ownerType, ownerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.Errorf("failed to determine ownership: %w", err)
|
return false, errors.Errorf("failed to determine ownership: %w", err)
|
||||||
}
|
}
|
||||||
if visibility == types.VisibilityPublic {
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
if !isProjectMember {
|
if !isProjectMember {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,9 +286,9 @@ func (g *Gateway) Run(ctx context.Context) error {
|
||||||
apirouter.Handle("/orgs/{orgref}/members/{userref}", authForcedHandler(addOrgMemberHandler)).Methods("PUT")
|
apirouter.Handle("/orgs/{orgref}/members/{userref}", authForcedHandler(addOrgMemberHandler)).Methods("PUT")
|
||||||
apirouter.Handle("/orgs/{orgref}/members/{userref}", authForcedHandler(removeOrgMemberHandler)).Methods("DELETE")
|
apirouter.Handle("/orgs/{orgref}/members/{userref}", authForcedHandler(removeOrgMemberHandler)).Methods("DELETE")
|
||||||
|
|
||||||
apirouter.Handle("/runs/{runid}", authForcedHandler(runHandler)).Methods("GET")
|
apirouter.Handle("/runs/{runid}", authOptionalHandler(runHandler)).Methods("GET")
|
||||||
apirouter.Handle("/runs/{runid}/actions", authForcedHandler(runActionsHandler)).Methods("PUT")
|
apirouter.Handle("/runs/{runid}/actions", authForcedHandler(runActionsHandler)).Methods("PUT")
|
||||||
apirouter.Handle("/runs/{runid}/tasks/{taskid}", authForcedHandler(runtaskHandler)).Methods("GET")
|
apirouter.Handle("/runs/{runid}/tasks/{taskid}", authOptionalHandler(runtaskHandler)).Methods("GET")
|
||||||
apirouter.Handle("/runs/{runid}/tasks/{taskid}/actions", authForcedHandler(runTaskActionsHandler)).Methods("PUT")
|
apirouter.Handle("/runs/{runid}/tasks/{taskid}/actions", authForcedHandler(runTaskActionsHandler)).Methods("PUT")
|
||||||
apirouter.Handle("/runs", authForcedHandler(runsHandler)).Methods("GET")
|
apirouter.Handle("/runs", authForcedHandler(runsHandler)).Methods("GET")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue