fix: align CHFS directory rule inheritance
This commit is contained in:
@@ -89,6 +89,18 @@ func (m *Manager) Authenticate(user, pwd string) *Account {
|
||||
return nil
|
||||
}
|
||||
func (a *Account) MaskFor(path string) PermMask {
|
||||
return a.maskFor(path, false)
|
||||
}
|
||||
|
||||
// MaskForEntry returns the permission shown for a directory/file while its
|
||||
// parent directory is being listed. CHFS section rules rule.r/rule.w/rule.d
|
||||
// affect the contents of the named directory, but the directory entry itself
|
||||
// keeps the inherited permission until it is opened.
|
||||
func (a *Account) MaskForEntry(path string) PermMask {
|
||||
return a.maskFor(path, true)
|
||||
}
|
||||
|
||||
func (a *Account) maskFor(path string, entry bool) PermMask {
|
||||
path = strings.Trim(path, "/")
|
||||
best := -1
|
||||
mask := a.Mask
|
||||
@@ -97,7 +109,7 @@ func (a *Account) MaskFor(path string) PermMask {
|
||||
if !matchPath(d, path) {
|
||||
continue
|
||||
}
|
||||
if r.ChildrenOnly && matchPathExact(d, path) {
|
||||
if entry && r.ChildrenOnly && matchPathExact(d, path) {
|
||||
continue
|
||||
}
|
||||
if len(d) > best {
|
||||
|
||||
Reference in New Issue
Block a user