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

Function CanRead

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

Source from the content-addressed store, hash-verified

19}
20
21func CanRead(user *model.User, meta *model.Meta, path string) bool {
22 // nil user is treated as internal/system context and bypasses per-user read restrictions
23 if user == nil {
24 return true
25 }
26 if meta != nil && len(meta.ReadUsers) > 0 && !slices.Contains(meta.ReadUsers, user.ID) && MetaCoversPath(meta.Path, path, meta.ReadUsersSub) {
27 return false
28 }
29 return true
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

Callers 6

filterReadableObjsFunction · 0.92
copyFilesFunction · 0.92
GenerateTorrentForPathFunction · 0.92
FsCopyFunction · 0.92
TestCanReadFunction · 0.85
CanAccessFunction · 0.85

Calls 1

MetaCoversPathFunction · 0.85

Tested by 1

TestCanReadFunction · 0.68