You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-20 12:02:22 +03:00
Add a way to lock users
This commit is contained in:
@@ -53,6 +53,8 @@ struct SessionLookup {
|
||||
user_id: Uuid,
|
||||
user_username: String,
|
||||
user_primary_user_email_id: Option<Uuid>,
|
||||
user_created_at: DateTime<Utc>,
|
||||
user_locked_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
impl TryFrom<SessionLookup> for BrowserSession {
|
||||
@@ -65,6 +67,8 @@ impl TryFrom<SessionLookup> for BrowserSession {
|
||||
username: value.user_username,
|
||||
sub: id.to_string(),
|
||||
primary_user_email_id: value.user_primary_user_email_id.map(Into::into),
|
||||
created_at: value.user_created_at,
|
||||
locked_at: value.user_locked_at,
|
||||
};
|
||||
|
||||
Ok(BrowserSession {
|
||||
@@ -99,6 +103,8 @@ impl<'c> BrowserSessionRepository for PgBrowserSessionRepository<'c> {
|
||||
, u.user_id
|
||||
, u.username AS "user_username"
|
||||
, u.primary_user_email_id AS "user_primary_user_email_id"
|
||||
, u.created_at AS "user_created_at"
|
||||
, u.locked_at AS "user_locked_at"
|
||||
FROM user_sessions s
|
||||
INNER JOIN users u
|
||||
USING (user_id)
|
||||
@@ -232,6 +238,14 @@ impl<'c> BrowserSessionRepository for PgBrowserSessionRepository<'c> {
|
||||
Expr::col((Users::Table, Users::PrimaryUserEmailId)),
|
||||
SessionLookupIden::UserPrimaryUserEmailId,
|
||||
)
|
||||
.expr_as(
|
||||
Expr::col((Users::Table, Users::CreatedAt)),
|
||||
SessionLookupIden::UserCreatedAt,
|
||||
)
|
||||
.expr_as(
|
||||
Expr::col((Users::Table, Users::LockedAt)),
|
||||
SessionLookupIden::UserLockedAt,
|
||||
)
|
||||
.from(UserSessions::Table)
|
||||
.inner_join(
|
||||
Users::Table,
|
||||
|
||||
Reference in New Issue
Block a user