skip permission checking when creating dir or files

This commit is contained in:
Chris Lu 2018-05-19 12:40:24 -07:00
parent ab4ddb1e0e
commit 793dd81ca2
2 changed files with 6 additions and 1 deletions

View file

@ -56,7 +56,7 @@ func (f *Filer) CreateEntry(entry *Entry) (error) {
if dirFindErr != nil { if dirFindErr != nil {
return fmt.Errorf("findDirectory %s: %v", dirPath, dirFindErr) return fmt.Errorf("findDirectory %s: %v", dirPath, dirFindErr)
} }
}else{ } else {
glog.V(4).Infof("found cached directory: %s", dirPath) glog.V(4).Infof("found cached directory: %s", dirPath)
} }
@ -98,9 +98,13 @@ func (f *Filer) CreateEntry(entry *Entry) (error) {
return fmt.Errorf("parent folder not found: %v", entry.FullPath) return fmt.Errorf("parent folder not found: %v", entry.FullPath)
} }
/*
if !hasWritePermission(lastDirectoryEntry, entry) { if !hasWritePermission(lastDirectoryEntry, entry) {
glog.V(0).Infof("directory %s: %v, entry: uid=%d gid=%d",
lastDirectoryEntry.FullPath, lastDirectoryEntry.Attr, entry.Uid, entry.Gid)
return fmt.Errorf("no write permission in folder %v", lastDirectoryEntry.FullPath) return fmt.Errorf("no write permission in folder %v", lastDirectoryEntry.FullPath)
} }
*/
if err := f.store.InsertEntry(entry); err != nil { if err := f.store.InsertEntry(entry); err != nil {
return fmt.Errorf("insert entry %s: %v", entry.FullPath, err) return fmt.Errorf("insert entry %s: %v", entry.FullPath, err)

View file

@ -84,6 +84,7 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
glog.V(1).Infof("mkdir: %v", request) glog.V(1).Infof("mkdir: %v", request)
if _, err := client.CreateEntry(ctx, request); err != nil { if _, err := client.CreateEntry(ctx, request); err != nil {
glog.V(0).Infof("mkdir %v: %v", request, err)
return fmt.Errorf("make dir: %v", err) return fmt.Errorf("make dir: %v", err)
} }