@@ -42,8 +42,8 @@ pub async fn certificate_templates_list(
4242) -> Result < HttpResponse , Error > {
4343 let templates = state
4444 . api
45- . certificates ( )
46- . get_certificate_templates ( user . id )
45+ . certificates ( & user )
46+ . get_certificate_templates ( )
4747 . await ?;
4848 Ok ( HttpResponse :: Ok ( ) . json ( templates) )
4949}
@@ -77,9 +77,9 @@ pub async fn certificate_templates_get(
7777 )
7878 . await ?;
7979
80- let certificates = state. api . certificates ( ) ;
80+ let certificates = state. api . certificates ( & user ) ;
8181 let Some ( template) = certificates
82- . get_certificate_template ( user . id , path. template_id )
82+ . get_certificate_template ( path. template_id )
8383 . await ?
8484 else {
8585 return Err ( Error :: not_found ( "Certificate template not found." ) ) ;
@@ -119,8 +119,8 @@ pub async fn certificate_templates_create(
119119) -> Result < HttpResponse , Error > {
120120 let template = state
121121 . api
122- . certificates ( )
123- . create_certificate_template ( user . id , body. into_inner ( ) )
122+ . certificates ( & user )
123+ . create_certificate_template ( body. into_inner ( ) )
124124 . await ?;
125125 Ok ( HttpResponse :: Created ( ) . json ( template) )
126126}
@@ -145,8 +145,8 @@ pub async fn certificate_templates_update(
145145) -> Result < HttpResponse , Error > {
146146 state
147147 . api
148- . certificates ( )
149- . update_certificate_template ( user . id , path. template_id , body. into_inner ( ) )
148+ . certificates ( & user )
149+ . update_certificate_template ( path. template_id , body. into_inner ( ) )
150150 . await ?;
151151 Ok ( HttpResponse :: NoContent ( ) . finish ( ) )
152152}
@@ -169,8 +169,8 @@ pub async fn certificate_templates_delete(
169169) -> Result < HttpResponse , Error > {
170170 state
171171 . api
172- . certificates ( )
173- . remove_certificate_template ( user . id , path. template_id )
172+ . certificates ( & user )
173+ . remove_certificate_template ( path. template_id )
174174 . await ?;
175175 Ok ( HttpResponse :: NoContent ( ) . finish ( ) )
176176}
@@ -206,8 +206,8 @@ pub async fn certificate_templates_generate(
206206
207207 let data = state
208208 . api
209- . certificates ( )
210- . generate_self_signed_certificate ( user . id , path. template_id , body. into_inner ( ) )
209+ . certificates ( & user )
210+ . generate_self_signed_certificate ( path. template_id , body. into_inner ( ) )
211211 . await ?;
212212 Ok ( HttpResponse :: Ok ( ) . json ( data) )
213213}
@@ -230,8 +230,8 @@ pub async fn certificate_templates_share(
230230) -> Result < HttpResponse , Error > {
231231 let user_share = state
232232 . api
233- . certificates ( )
234- . share_certificate_template ( user . id , path. template_id )
233+ . certificates ( & user )
234+ . share_certificate_template ( path. template_id )
235235 . await
236236 . map ( ClientUserShare :: from) ?;
237237 Ok ( HttpResponse :: Ok ( ) . json ( user_share) )
@@ -254,8 +254,8 @@ pub async fn certificate_templates_unshare(
254254) -> Result < HttpResponse , Error > {
255255 state
256256 . api
257- . certificates ( )
258- . unshare_certificate_template ( user . id , path. template_id )
257+ . certificates ( & user )
258+ . unshare_certificate_template ( path. template_id )
259259 . await ?;
260260 Ok ( HttpResponse :: NoContent ( ) . finish ( ) )
261261}
@@ -276,10 +276,9 @@ pub async fn certificates_fetch(
276276 user : User ,
277277 body : web:: Json < TemplatesFetchCertificatesParams > ,
278278) -> Result < HttpResponse , Error > {
279- let _ = user; // authenticated but not used for this operation
280279 let certs = state
281280 . api
282- . certificates ( )
281+ . certificates ( & user )
283282 . get_peer_certificates ( & body. url )
284283 . await ?;
285284 Ok ( HttpResponse :: Ok ( ) . json ( certs) )
0 commit comments