MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / CanWrite

Function CanWrite

server/common/check.go:32–41  ·  view source on GitHub ↗
(user *model.User, meta *model.Meta, path string)

Source from the content-addressed store, hash-verified

30}
31
32func CanWrite(user *model.User, meta *model.Meta, path string) bool {
33 // nil user is treated as internal/system context and bypasses per-user write restrictions
34 if user == nil {
35 return true
36 }
37 if meta != nil && len(meta.WriteUsers) > 0 && !slices.Contains(meta.WriteUsers, user.ID) && MetaCoversPath(meta.Path, path, meta.WriteUsersSub) {
38 return false
39 }
40 return true
41}
42
43func CanWriteContentBypassUserPerms(meta *model.Meta, path string) bool {
44 if meta == nil || !meta.Write {

Callers 15

FsUpFunction · 0.92
handleDeleteMethod · 0.92
handlePutMethod · 0.92
handleMkcolMethod · 0.92
handleLockMethod · 0.92
handleUnlockMethod · 0.92
handleProppatchMethod · 0.92
moveFilesFunction · 0.92
copyFilesFunction · 0.92
callFSListMethod · 0.92
TorrentRapidUploadFunction · 0.92
FsArchiveDecompressFunction · 0.92

Calls 1

MetaCoversPathFunction · 0.85

Tested by 2

TestCanWriteFunction · 0.68