Skip to content

Commit

Permalink
Change serde parsing logic to accomodate JS swagger, added permission…
Browse files Browse the repository at this point in the history
… resolver with unit tests
  • Loading branch information
dxu2atlassian committed Jan 3, 2025
1 parent a7ad816 commit 33ab089
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/forge_analyzer/src/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ impl FunctionAnalyzer<'_> {
[PropPath::Def(def), ref authn @ .., PropPath::Static(ref last)]
if (*last == *"requestJira"
|| *last == *"requestConfluence"
|| *last == *"requestBitbucket")
|| *last == *"requestBitbucket") // TODO: resolve Jira API requests to the correct permission map, here JSM (and likely JS) is bundled inside Jira
&& Some(&ImportKind::Default)
== self.res.is_imported_from(def, "@forge/api") =>
{
Expand Down
6 changes: 6 additions & 0 deletions crates/forge_permission_resolver/src/permissions_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ mod test {
let request_type = RequestType::Get;
let result = check_url_for_permissions(&permission_map, &regex_map, request_type, url);

println!("Permission Map: {:?}", permission_map);
println!("Regex Map: {:?}", regex_map);

assert!(!result.is_empty(), "Should have parsed permissions");
assert!(
result.contains(&String::from("read:sprint:jira-software")),
Expand All @@ -409,6 +412,9 @@ mod test {
let request_type = RequestType::Get;
let result = check_url_for_permissions(&permission_map, &regex_map, request_type, url);

println!("Permission Map: {:?}", permission_map);
println!("Regex Map: {:?}", regex_map);

assert!(!result.is_empty(), "Should have parsed permissions");

let expected_permission: Vec<String> = vec![
Expand Down

0 comments on commit 33ab089

Please sign in to comment.