Skip to content

Commit 9b22e58

Browse files
committed
Fix superuser's ability to manually delete an internal file via deleteFile
1 parent 10f72c8 commit 9b22e58

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ To see every change with descriptions aimed at developers, see
77
As a continuously updated web app, Coauthor uses dates
88
instead of version numbers.
99

10+
## 2025-02-10
11+
12+
* Fix superuser's ability to manually delete an internal file via `deleteFile`
13+
[[#279](https://github.com/edemaine/coauthor/issues/279)]
14+
1015
## 2025-02-06
1116

1217
* Remove duplicate file description in unrendered files (non-images/videos/PDFs)

lib/files.coffee

+4
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ if Meteor.isServer
141141
#file.metadata?.uploader == userId or
142142
fileRoleCheck file, 'read', userId
143143
remove: (userId, file) ->
144+
## Support `deleteFile` which calls `Files.remove` which goes over socket.
145+
## This sets Meteor.userId but meteor-file-collection
146+
## just checks X-Auth-Token
147+
userId ?= Meteor.user()
144148
#file.metadata?.uploader == userId
145149
fileRoleCheck file, 'super', userId
146150
else

0 commit comments

Comments
 (0)