Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloudsplaining/output/src/test/principals-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ it("principals.getPrincipalMetadata: should return principal object", function (

it("principals.getPrincipalIds: should return a list of principal IDs for a given principal type", function () {
var result = principals.getPrincipalIds(iam_data, "User");
var expectedResult = ["ASIAZZUSERZZPLACEHOLDER", "obama"]
var expectedResult = ["obama", "ASIAZZUSERZZPLACEHOLDER"]
assert.deepStrictEqual(result, expectedResult);
console.log(`Should return the list of users ["obama", "ASIAZZUSERZZPLACEHOLDER"]: ${JSON.stringify(result)}`);
});
Expand Down
22 changes: 16 additions & 6 deletions cloudsplaining/output/src/util/principals.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,28 @@ function getPrincipalNames(iam_data, principalType) {
function getPrincipalIds(iam_data, principalType) {
let result;
if (principalType.toLowerCase() === "role") {
result = Object.keys(iam_data["roles"])
return result.sort();
result = Object.keys(iam_data["roles"]);
return result.sort(function(a, b) {
let nameA = (iam_data["roles"][a].name || a).toLowerCase();
let nameB = (iam_data["roles"][b].name || b).toLowerCase();
return nameA.localeCompare(nameB);
});
}
if (principalType.toLowerCase() === "group") {
result = Object.keys(iam_data["groups"]);
result.sort();
return result
return result.sort(function(a, b) {
let nameA = (iam_data["groups"][a].name || a).toLowerCase();
let nameB = (iam_data["groups"][b].name || b).toLowerCase();
return nameA.localeCompare(nameB);
});
}
if (principalType.toLowerCase() === "user") {
result = Object.keys(iam_data["users"]);
result.sort();
return result
return result.sort(function(a, b) {
let nameA = (iam_data["users"][a].name || a).toLowerCase();
let nameB = (iam_data["users"][b].name || b).toLowerCase();
return nameA.localeCompare(nameB);
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ requires = ["uv_build~=0.10.0"]
build-backend = "uv_build"

[tool.uv]
required-version = "~=0.10.0"
required-version = ">=0.10.0"

[tool.uv.build-backend]
module-name = "cloudsplaining"
Expand Down