File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,17 +84,13 @@ pub enum State {
8484}
8585
8686impl State {
87- pub fn user ( & self ) -> Option < & editoast_models :: User > {
87+ pub fn user ( & self ) -> Option < authz :: User > {
8888 match self {
8989 State :: Skip => None ,
90- State :: Authenticated { user, .. } => Some ( user) ,
90+ State :: Authenticated { user, .. } => Some ( authz :: User ( user. id ) ) ,
9191 }
9292 }
9393
94- pub fn authz_user ( & self ) -> Option < authz:: User > {
95- self . user ( ) . map ( |user| authz:: User ( user. id ) )
96- }
97-
9894 pub fn roles ( & self ) -> & [ Role ] {
9995 static EMPTY_ROLES : [ Role ; 0 ] = [ ] ;
10096 match self {
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ pub(in crate::views) async fn user_groups(
163163 } ) : State < AppState > ,
164164) -> Result < Json < Vec < Group > > > {
165165 let user = authn_state
166- . authz_user ( )
166+ . user ( )
167167 . ok_or ( AuthorizationError :: Unauthenticated ) ?;
168168 let authorizer = authn_state. authorizer ( regulator. openfga ( ) , db_pool. get ( ) . await ?) ;
169169 let user_groups = authz:: v2:: user_groups ( user)
@@ -528,7 +528,7 @@ pub(in crate::views) async fn user_grants(
528528 Json ( body) : Json < HashMap < ResourceType , Vec < i64 > > > ,
529529) -> Result < Json < HashMap < ResourceType , Vec < UserResourceGrant > > > > {
530530 let user = authn_state
531- . authz_user ( )
531+ . user ( )
532532 . ok_or ( AuthorizationError :: Unauthenticated ) ?;
533533 let authorizer = authn_state. authorizer ( regulator. openfga ( ) , db_pool. get ( ) . await ?) ;
534534 let mut response = HashMap :: < _ , Vec < UserResourceGrant > > :: new ( ) ;
You can’t perform that action at this time.
0 commit comments