File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use swirl::Job;
5
5
6
6
use super :: { extract_crate_name_and_semver, version_and_crate} ;
7
7
use crate :: controllers:: cargo_prelude:: * ;
8
+ use crate :: models:: token:: EndpointScope ;
8
9
use crate :: models:: Rights ;
9
10
use crate :: models:: { insert_version_owner_action, VersionAction } ;
10
11
use crate :: schema:: versions;
@@ -32,9 +33,14 @@ pub fn unyank(req: &mut dyn RequestExt) -> EndpointResult {
32
33
fn modify_yank ( req : & mut dyn RequestExt , yanked : bool ) -> EndpointResult {
33
34
// FIXME: Should reject bad requests before authentication, but can't due to
34
35
// lifetime issues with `req`.
35
- let auth = AuthCheck :: default ( ) . check ( req ) ? ;
36
+
36
37
let ( crate_name, semver) = extract_crate_name_and_semver ( req) ?;
37
38
39
+ let auth = AuthCheck :: default ( )
40
+ . with_endpoint_scope ( EndpointScope :: Yank )
41
+ . for_crate ( crate_name)
42
+ . check ( req) ?;
43
+
38
44
let conn = req. db_write ( ) ?;
39
45
let ( version, krate) = version_and_crate ( & conn, crate_name, semver) ?;
40
46
let api_token_id = auth. api_token_id ( ) ;
You can’t perform that action at this time.
0 commit comments