1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-07-22 03:58:21 +00:00

Added read_only bit to users_collections

This commit is contained in:
Daniel García 2018-05-04 20:10:35 +02:00
commit 79b4ddcae8
5 changed files with 24 additions and 22 deletions

View file

@ -106,15 +106,17 @@ use super::User;
pub struct CollectionUsers {
pub user_uuid: String,
pub collection_uuid: String,
pub read_only: bool,
}
/// Database methods
impl CollectionUsers {
pub fn save(user_uuid: &str, collection_uuid: &str, conn: &DbConn) -> bool {
pub fn save(user_uuid: &str, collection_uuid: &str, read_only:bool, conn: &DbConn) -> bool {
match diesel::replace_into(users_collections::table)
.values((
users_collections::user_uuid.eq(user_uuid),
users_collections::collection_uuid.eq(collection_uuid)
users_collections::collection_uuid.eq(collection_uuid),
users_collections::read_only.eq(read_only),
)).execute(&**conn) {
Ok(1) => true, // One row inserted
_ => false,