Extends Cipher::is_write_accessible_to_user with a check for any collection that might give R/W access to cipher.
Implements Cipher::is_accessible_to_user with a proper check for any RO access.
The current solution works quite well, but I don't like the code repetition. Any input would be greatly appreciated how to solve this in some reasonable manner. I was thinking about using into_boxed() at some stage to promote some code reuse, but I just don't know enough about diesel to pull this off successfully.
Other approach would be to split it into multiple sub-checks and aggregate those but that would lead to 5x the amount of queries, which I'd like to avoid.
Any ideas?
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/dani-garcia/vaultwarden/pull/36
**Author:** [@mprasil](https://github.com/mprasil)
**Created:** 5/31/2018
**Status:** ✅ Merged
**Merged:** 6/1/2018
**Merged by:** [@dani-garcia](https://github.com/dani-garcia)
**Base:** `master` ← **Head:** `cipher_access`
---
### 📝 Commits (2)
- [`e2b4f3b`](https://github.com/dani-garcia/vaultwarden/commit/e2b4f3b13f2be9ccbde0c1915a213a319eb5c13f) Bettech check for cipher access
- [`ac2ca58`](https://github.com/dani-garcia/vaultwarden/commit/ac2ca5812ba0385f3e09351c9a3b9773a0285665) Remove unused UserOrganization
### 📊 Changes
**1 file changed** (+48 additions, -20 deletions)
<details>
<summary>View changed files</summary>
📝 `src/db/models/cipher.rs` (+48 -20)
</details>
### 📄 Description
This checks out two TODOs:
1. Extends `Cipher::is_write_accessible_to_user` with a check for any collection that might give R/W access to cipher.
2. Implements `Cipher::is_accessible_to_user` with a proper check for any RO access.
The current solution works quite well, but I don't like the code repetition. Any input would be greatly appreciated how to solve this in some reasonable manner. I was thinking about using `into_boxed()` at some stage to promote some code reuse, but I just don't know enough about diesel to pull this off successfully.
Other approach would be to split it into multiple sub-checks and aggregate those but that would lead to 5x the amount of queries, which I'd like to avoid.
Any ideas?
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/36
Author: @mprasil
Created: 5/31/2018
Status: ✅ Merged
Merged: 6/1/2018
Merged by: @dani-garcia
Base:
master← Head:cipher_access📝 Commits (2)
e2b4f3bBettech check for cipher accessac2ca58Remove unused UserOrganization📊 Changes
1 file changed (+48 additions, -20 deletions)
View changed files
📝
src/db/models/cipher.rs(+48 -20)📄 Description
This checks out two TODOs:
Cipher::is_write_accessible_to_userwith a check for any collection that might give R/W access to cipher.Cipher::is_accessible_to_userwith a proper check for any RO access.The current solution works quite well, but I don't like the code repetition. Any input would be greatly appreciated how to solve this in some reasonable manner. I was thinking about using
into_boxed()at some stage to promote some code reuse, but I just don't know enough about diesel to pull this off successfully.Other approach would be to split it into multiple sub-checks and aggregate those but that would lead to 5x the amount of queries, which I'd like to avoid.
Any ideas?
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.