Adding upload permission to users, directory structure readme update

This commit is contained in:
advplyr 2021-09-18 12:45:34 -05:00
parent 07994d38d5
commit c884fd6880
12 changed files with 148 additions and 75 deletions

View file

@ -32,6 +32,9 @@ class User {
get canDownload() {
return !!this.permissions.download && this.isActive
}
get canUpload() {
return !!this.permissions.upload && this.isActive
}
getDefaultUserSettings() {
return {
@ -47,7 +50,8 @@ class User {
return {
download: true,
update: true,
delete: this.id === 'root'
delete: this.type === 'root',
upload: this.type === 'root' || this.type === 'admin'
}
}
@ -112,6 +116,8 @@ class User {
this.createdAt = user.createdAt || Date.now()
this.settings = user.settings || this.getDefaultUserSettings()
this.permissions = user.permissions || this.getDefaultUserPermissions()
// Upload permission added v1.1.13, make sure root user has upload permissions
if (this.type === 'root' && !this.permissions.upload) this.permissions.upload = true
}
update(payload) {