Skip to content

Commit

Permalink
Check for ReadWriteDelete password enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed Apr 27, 2022
1 parent 259b445 commit 633819f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,19 @@ export default {
const canRead = currentRole.role.hasPermission(SharePermissions.read)
const canCreate = currentRole.role.hasPermission(SharePermissions.create)
const canDelete = currentRole.role.hasPermission(SharePermissions.delete)
if (this.passwordEnforced.read_only === true) {
return canRead && !canCreate
return canRead && !canCreate && !canDelete
}
if (this.passwordEnforced.upload_only === true) {
return !canRead && canCreate
return !canRead && canCreate && !canDelete
}
if (this.passwordEnforced.read_write === true) {
return canRead && canCreate
return canRead && canCreate && !canDelete
}
if (this.passwordEnforced.read_write_delete === true) {
return canRead && canCreate && canDelete
}
return false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,19 @@ export default {
const canRead = currentRole.role.hasPermission(SharePermissions.read)
const canCreate = currentRole.role.hasPermission(SharePermissions.create)
const canDelete = currentRole.role.hasPermission(SharePermissions.delete)
if (this.passwordEnforced.read_only === true) {
return canRead && !canCreate
return canRead && !canCreate && !canDelete
}
if (this.passwordEnforced.upload_only === true) {
return !canRead && canCreate
return !canRead && canCreate && !canDelete
}
if (this.passwordEnforced.read_write === true) {
return canRead && canCreate
return canRead && canCreate && !canDelete
}
if (this.passwordEnforced.read_write_delete === true) {
return canRead && canCreate && canDelete
}
return false
},
Expand Down

0 comments on commit 633819f

Please sign in to comment.