X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/10afc7ae2f95aad09937465702be7c44d07920d4..4a264f6333b34ecc364d2a6f9e18c7f3e35a076d:/services/keep-web/handler.go diff --git a/services/keep-web/handler.go b/services/keep-web/handler.go index 6f6ff542b5..97ec95e3aa 100644 --- a/services/keep-web/handler.go +++ b/services/keep-web/handler.go @@ -864,12 +864,9 @@ func (h *handler) seeOtherWithCookie(w http.ResponseWriter, r *http.Request, loc } func (h *handler) userPermittedToUploadOrDownload(method string, tokenUser *arvados.User) bool { - if tokenUser == nil { - return false - } var permitDownload bool var permitUpload bool - if tokenUser.IsAdmin { + if tokenUser != nil && tokenUser.IsAdmin { permitUpload = h.Config.cluster.Collections.WebDAVPermission.Admin.Upload permitDownload = h.Config.cluster.Collections.WebDAVPermission.Admin.Download } else { @@ -900,9 +897,13 @@ func (h *handler) logUploadOrDownload( log := ctxlog.FromContext(r.Context()) props := make(map[string]string) props["reqPath"] = r.URL.Path + var useruuid string if user != nil { log = log.WithField("user_uuid", user.UUID). WithField("user_full_name", user.FullName) + useruuid = user.UUID + } else { + useruuid = fmt.Sprintf("%s-tpzed-anonymouspublic", h.Config.cluster.ClusterID) } if collection == nil && fs != nil { collection, filepath = h.determineCollection(fs, filepath) @@ -918,7 +919,7 @@ func (h *handler) logUploadOrDownload( if h.Config.cluster.Collections.WebDAVLogEvents { go func() { lr := arvadosclient.Dict{"log": arvadosclient.Dict{ - "object_uuid": user.UUID, + "object_uuid": useruuid, "event_type": "file_upload", "properties": props}} err := client.Create("logs", lr, nil) @@ -936,7 +937,7 @@ func (h *handler) logUploadOrDownload( if h.Config.cluster.Collections.WebDAVLogEvents { go func() { lr := arvadosclient.Dict{"log": arvadosclient.Dict{ - "object_uuid": user.UUID, + "object_uuid": useruuid, "event_type": "file_download", "properties": props}} err := client.Create("logs", lr, nil)