aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2018-09-06 00:44:32 +0200
committerKatharina Fey <kookie@spacekookie.de>2018-09-06 00:44:32 +0200
commitc86cd21da7e5797a33f22c06004ec5c32bdeac05 (patch)
treef119bba629f517bf07101a2460c9ba96c0fe5dc0
parent8b9c8668e9a3aaa56a41be04859a05abb94db60c (diff)
Removing deprecated `UserStore` and `KeyStore` into new `users::UserStore`
and fixing all resulting code issues
-rw-r--r--lockchain-core/src/crypto/mod.rs1
-rw-r--r--lockchain-core/src/lib.rs2
-rw-r--r--lockchain-core/src/users/mod.rs9
-rw-r--r--lockchain-files/src/lib.rs32
-rw-r--r--lockchain-http/src/handlers.rs2
5 files changed, 27 insertions, 19 deletions
diff --git a/lockchain-core/src/crypto/mod.rs b/lockchain-core/src/crypto/mod.rs
index ef52912..11aace0 100644
--- a/lockchain-core/src/crypto/mod.rs
+++ b/lockchain-core/src/crypto/mod.rs
@@ -19,4 +19,3 @@ pub mod hashing;
pub use self::data::PackedData;
pub use self::keys::{Key, KeyType};
-pub use users::KeyStore; \ No newline at end of file
diff --git a/lockchain-core/src/lib.rs b/lockchain-core/src/lib.rs
index 9c9ba95..b3d0931 100644
--- a/lockchain-core/src/lib.rs
+++ b/lockchain-core/src/lib.rs
@@ -76,7 +76,7 @@ mod record;
pub mod traits;
pub mod users;
-mod initialise;
+pub mod initialise;
pub use self::crypto::PackedData;
pub use self::meta::{MetaDomain, VaultMetadata};
diff --git a/lockchain-core/src/users/mod.rs b/lockchain-core/src/users/mod.rs
index 3fce31c..5fe1601 100644
--- a/lockchain-core/src/users/mod.rs
+++ b/lockchain-core/src/users/mod.rs
@@ -12,27 +12,18 @@
//!
//! `User` is also a serialisable struct which contains important
//! data to load and store them into a metadata store.
-#![allow(deprecated)]
mod auth;
mod user;
mod rights;
mod tokens;
-mod keystore;
mod secrets;
pub mod userstore;
pub use self::auth::pam_authenticate;
-pub use self::keystore::KeyStore;
pub use self::tokens::Token;
pub use self::user::User;
pub use errors::AuthError;
pub use self::rights::{Access, Role};
-
-use std::collections::HashMap;
-use {
- meta::MetaDomain,
- traits::{AutoEncoder, Base64AutoEncoder},
-};
diff --git a/lockchain-files/src/lib.rs b/lockchain-files/src/lib.rs
index 320714b..97912be 100644
--- a/lockchain-files/src/lib.rs
+++ b/lockchain-files/src/lib.rs
@@ -55,16 +55,19 @@ extern crate serde_derive;
extern crate serde;
use lcc::traits::{Body, LoadRecord, Vault};
-use lcc::{users::Token, MetaDomain, Payload, Record, VaultMetadata};
+use lcc::{
+ initialise::Generator,
+ users::{Access, Token},
+ MetaDomain, Payload, Record, VaultMetadata,
+};
use std::collections::HashMap;
+mod config;
mod fs;
mod utils;
-mod config;
+pub use config::{ConfigError, VaultConfig};
use fs::{FileType, Filesystem};
-pub use config::{VaultConfig, ConfigError};
-
/// Persistence mapper to a folder and file structure
///
@@ -112,16 +115,31 @@ impl<T: Body> DataVault<T> {
impl<T: Body> LoadRecord<T> for DataVault<T> {}
impl<T: Body> Vault<T> for DataVault<T> {
- fn new(name: &str, location: &str) -> DataVault<T> {
+ fn new(gen: Generator) -> DataVault<T> {
Self {
- meta_info: (name.into(), location.into()),
+ meta_info: (
+ gen.name.clone().unwrap().into(),
+ gen.location.clone().unwrap().into(),
+ ),
records: HashMap::new(),
config: VaultConfig::new(),
metadata: HashMap::new(),
- fs: Filesystem::new(location, name),
+ fs: Filesystem::new(&gen.location.unwrap(), &gen.name.unwrap()),
}.initialize()
}
+ fn create_user(
+ &mut self,
+ token: Token,
+ username: &str,
+ secret: &str,
+ access: Vec<Access>,
+ ) -> Result<(), ()> {
+ unimplemented!()
+ }
+
+ fn delete_user(&mut self, token: Token, username: &str) {}
+
// Checking if a vault exists is basically checking it's config
// against the compatible version of this library.
//
diff --git a/lockchain-http/src/handlers.rs b/lockchain-http/src/handlers.rs
index 8ce44da..287ef54 100644
--- a/lockchain-http/src/handlers.rs
+++ b/lockchain-http/src/handlers.rs
@@ -46,7 +46,7 @@ where
(&item.location).into()
};
- state.add_vault(&item.name, V::new(&item.name, location.to_str().unwrap()));
+ // state.add_vault(&item.name, V::new(&item.name, location.to_str().unwrap()));
Json(Response::Success)
}