mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-27 19:53:41 +08:00
fix (nfs): nfs permissions
This commit is contained in:
@ -136,20 +136,41 @@ func (this NfsShare) Meta(path string) Metadata {
|
|||||||
|
|
||||||
if fattr == nil { // happen at the root
|
if fattr == nil { // happen at the root
|
||||||
return Metadata{}
|
return Metadata{}
|
||||||
} else if isIn(fattr.UID, []uint32{this.uid}) ||
|
}
|
||||||
isIn(fattr.GID, []uint32{this.gid}) ||
|
var (
|
||||||
isIn(fattr.GID, this.gids) {
|
r, w bool
|
||||||
return Metadata{}
|
perms = fattr.Mode().Perm()
|
||||||
|
)
|
||||||
|
if perms&0002 != 0 {
|
||||||
|
w = true
|
||||||
|
}
|
||||||
|
if perms&0004 != 0 {
|
||||||
|
r = true
|
||||||
|
}
|
||||||
|
if fattr.UID == this.uid {
|
||||||
|
if perms&0400 != 0 {
|
||||||
|
r = true
|
||||||
|
}
|
||||||
|
if perms&0200 != 0 {
|
||||||
|
w = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fattr.GID == this.gid) || isIn(fattr.GID, this.gids) {
|
||||||
|
if perms&0040 != 0 {
|
||||||
|
r = true
|
||||||
|
}
|
||||||
|
if perms&0020 != 0 {
|
||||||
|
w = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Metadata{
|
return Metadata{
|
||||||
CanSee: NewBool(false),
|
CanSee: NewBool(r),
|
||||||
CanCreateFile: NewBool(false),
|
CanCreateFile: NewBool(w),
|
||||||
CanCreateDirectory: NewBool(false),
|
CanCreateDirectory: NewBool(w),
|
||||||
CanRename: NewBool(false),
|
CanRename: NewBool(w),
|
||||||
CanMove: NewBool(false),
|
CanMove: NewBool(w),
|
||||||
CanUpload: NewBool(false),
|
CanUpload: NewBool(w),
|
||||||
CanDelete: NewBool(false),
|
CanDelete: NewBool(w),
|
||||||
CanShare: NewBool(false),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user