mirror of https://github.com/wekan/wekan
The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
472 B
28 lines
472 B
![]()
10 years ago
|
Avatars = new FS.Collection('avatars', {
|
||
|
stores: [
|
||
![]()
10 years ago
|
new FS.Store.GridFS('avatars'),
|
||
![]()
10 years ago
|
],
|
||
|
filter: {
|
||
![]()
10 years ago
|
maxSize: 72000,
|
||
![]()
10 years ago
|
allow: {
|
||
![]()
10 years ago
|
contentTypes: ['image/*'],
|
||
|
},
|
||
|
},
|
||
![]()
10 years ago
|
});
|
||
|
|
||
![]()
10 years ago
|
function isOwner(userId, file) {
|
||
![]()
10 years ago
|
return userId && userId === file.userId;
|
||
![]()
10 years ago
|
}
|
||
![]()
10 years ago
|
|
||
|
Avatars.allow({
|
||
|
insert: isOwner,
|
||
|
update: isOwner,
|
||
|
remove: isOwner,
|
||
![]()
10 years ago
|
download() { return true; },
|
||
|
fetch: ['userId'],
|
||
![]()
10 years ago
|
});
|
||
|
|
||
![]()
10 years ago
|
Avatars.files.before.insert((userId, doc) => {
|
||
![]()
10 years ago
|
doc.userId = userId;
|
||
|
});
|