File tree Expand file tree Collapse file tree
pangolin/pangolin_store/src/memory Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -333,6 +333,10 @@ impl CatalogStore for MemoryStore {
333333 async fn list_permissions ( & self , tenant_id : Uuid ) -> Result < Vec < pangolin_core:: permission:: Permission > > {
334334 self . list_permissions_internal ( None , None ) . await
335335 }
336+
337+ async fn list_user_permissions ( & self , user_id : Uuid ) -> Result < Vec < pangolin_core:: permission:: Permission > > {
338+ self . list_permissions_internal ( Some ( user_id) , None ) . await
339+ }
336340
337341 // Token operations
338342 async fn store_token ( & self , token_info : pangolin_core:: token:: TokenInfo ) -> Result < ( ) > {
Original file line number Diff line number Diff line change @@ -9,10 +9,20 @@ impl MemoryStore {
99 self . permissions . remove ( & permission_id) ;
1010 Ok ( ( ) )
1111 }
12- pub ( crate ) async fn list_permissions_internal ( & self , _user_id : Option < Uuid > , _resource_id : Option < Uuid > ) -> Result < Vec < Permission > > {
13- // MemoryStore simple implementation: just return all for now or implement filtering if needed
14- Ok ( self . permissions . iter ( ) . map ( |e| e. value ( ) . clone ( ) ) . collect ( ) )
12+ pub ( crate ) async fn list_permissions_internal ( & self , user_id : Option < Uuid > , _resource_id : Option < Uuid > ) -> Result < Vec < Permission > > {
13+ let mut permissions = Vec :: new ( ) ;
14+ for entry in self . permissions . iter ( ) {
15+ let p = entry. value ( ) ;
16+ if let Some ( uid) = user_id {
17+ if p. user_id == uid {
18+ permissions. push ( p. clone ( ) ) ;
19+ }
20+ } else {
21+ permissions. push ( p. clone ( ) ) ;
22+ }
1523 }
24+ Ok ( permissions)
25+ }
1626
1727 pub ( crate ) async fn create_permission_internal ( & self , permission : pangolin_core:: permission:: Permission ) -> Result < ( ) > {
1828 self . permissions . insert ( permission. id , permission) ;
You can’t perform that action at this time.
0 commit comments