Skip to content

Commit

Permalink
Use parent permissions when creating a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Jul 13, 2021
1 parent fc6c29d commit dc917cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/storage/fs/owncloudsql/owncloudsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -941,11 +941,16 @@ func (fs *ocfs) CreateDir(ctx context.Context, sp string) (err error) {
return err
}
mtime := time.Now().Unix()

permissions := 31 // 1: READ, 2: UPDATE, 4: CREATE, 8: DELETE, 16: SHARE
if perm, err := fs.readPermissions(ctx, filepath.Dir(ip)); err == nil {
permissions = int(conversions.RoleFromResourcePermissions(perm).OCSPermissions()) // inherit permissions of parent
}
data := map[string]interface{}{
"path": fs.toDatabasePath(ip),
"etag": calcEtag(ctx, fi),
"mimetype": "httpd/unix-directory",
"permissions": 31, // 1: READ, 2: UPDATE, 4: CREATE, 8: DELETE, 16: SHARE
"permissions": permissions,
"mtime": mtime,
"storage_mtime": mtime,
}
Expand Down

0 comments on commit dc917cd

Please sign in to comment.