1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-22 05:10:29 +01:00

Save extra query when checking write access

Dieser Commit ist enthalten in:
Miroslav Prasil 2018-05-04 13:42:30 +01:00
Ursprung a0796acbc7
Commit c4360ee697

Datei anzeigen

@ -183,11 +183,8 @@ impl Cipher {
}
pub fn is_write_accessible_to_user(&self, user_uuid: &str, conn: &DbConn) -> bool {
match ciphers::table
.filter(ciphers::user_uuid.eq(user_uuid))
.filter(ciphers::uuid.eq(&self.uuid))
.first::<Self>(&**conn).ok() {
Some(_) => true, // cipher directly owned by user
match self.user_uuid {
Some(ref self_user_uuid) => self_user_uuid == user_uuid, // cipher directly owned by user
None =>{
match self.organization_uuid {
Some(ref org_uuid) => {