mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 15:51:23 +01:00
add constructor for users service
This commit is contained in:
parent
f771d319b2
commit
e06d126d4e
2 changed files with 9 additions and 8 deletions
|
|
@ -1,7 +1,4 @@
|
||||||
use std::{
|
use std::sync::{Arc, OnceLock};
|
||||||
collections::BTreeMap,
|
|
||||||
sync::{Arc, Mutex as StdMutex, OnceLock},
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{observability::FilterReloadHandles, Config, Result};
|
use crate::{observability::FilterReloadHandles, Config, Result};
|
||||||
|
|
||||||
|
|
@ -173,10 +170,7 @@ impl Services {
|
||||||
},
|
},
|
||||||
transaction_ids: db,
|
transaction_ids: db,
|
||||||
uiaa: uiaa::Service::new(db),
|
uiaa: uiaa::Service::new(db),
|
||||||
users: users::Service {
|
users: users::Service::new(db),
|
||||||
db,
|
|
||||||
connections: StdMutex::new(BTreeMap::new()),
|
|
||||||
},
|
|
||||||
account_data: db,
|
account_data: db,
|
||||||
admin: admin::Service::build(),
|
admin: admin::Service::build(),
|
||||||
key_backups: db,
|
key_backups: db,
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,13 @@ pub(crate) struct Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Service {
|
impl Service {
|
||||||
|
pub(crate) fn new(db: &'static dyn Data) -> Self {
|
||||||
|
Self {
|
||||||
|
db,
|
||||||
|
connections: Mutex::new(BTreeMap::new()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if a user has an account on this homeserver.
|
/// Check if a user has an account on this homeserver.
|
||||||
pub(crate) fn exists(&self, user_id: &UserId) -> Result<bool> {
|
pub(crate) fn exists(&self, user_id: &UserId) -> Result<bool> {
|
||||||
self.db.exists(user_id)
|
self.db.exists(user_id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue