@@ -4,7 +4,7 @@ use std::ops::DerefMut;
4
4
use diesel:: { dsl, prelude:: * } ;
5
5
use diesel_async:: { scoped_futures:: ScopedFutureExt as _, RunQueryDsl } ;
6
6
use editoast_authz:: {
7
- authorizer:: { StorageDriver , UserInfo } ,
7
+ authorizer:: { StorageDriver , UserIdentity , UserInfo } ,
8
8
roles:: BuiltinRoleSet ,
9
9
} ;
10
10
use editoast_models:: DbConnection ;
@@ -38,11 +38,11 @@ impl<B: BuiltinRoleSet + Send + Sync> StorageDriver for PgAuthDriver<B> {
38
38
type BuiltinRole = B ;
39
39
type Error = AuthDriverError ;
40
40
41
- #[ tracing:: instrument( skip_all, fields( %user_info ) , ret( level = Level :: DEBUG ) , err) ]
42
- async fn get_user_id ( & self , user_info : & UserInfo ) -> Result < Option < i64 > , Self :: Error > {
41
+ #[ tracing:: instrument( skip_all, fields( %user_identity ) , ret( level = Level :: DEBUG ) , err) ]
42
+ async fn get_user_id ( & self , user_identity : & UserIdentity ) -> Result < Option < i64 > , Self :: Error > {
43
43
let id = authn_user:: table
44
44
. select ( authn_user:: id)
45
- . filter ( authn_user:: identity_id. eq ( & user_info . identity ) )
45
+ . filter ( authn_user:: identity_id. eq ( & user_identity ) )
46
46
. first :: < i64 > ( self . conn . write ( ) . await . deref_mut ( ) )
47
47
. await
48
48
. optional ( ) ?;
@@ -71,7 +71,7 @@ impl<B: BuiltinRoleSet + Send + Sync> StorageDriver for PgAuthDriver<B> {
71
71
self . conn
72
72
. transaction ( |conn| {
73
73
async move {
74
- let user_id = self . get_user_id ( user) . await ?;
74
+ let user_id = self . get_user_id ( & user. identity ) . await ?;
75
75
match user_id {
76
76
Some ( user_id) => {
77
77
tracing:: debug!( "user already exists in db" ) ;
0 commit comments