Skip to content

Commit

Permalink
Merge pull request #20 from ministryofjustice/remove-teams
Browse files Browse the repository at this point in the history
bugfix: filter out non-ministryofjustice teams; and remove all-org-members team
  • Loading branch information
jakemulley authored Apr 19, 2023
2 parents fdf9cd7 + b9af75e commit feffd88
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions add-github-teams-to-saml-mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ function(user, context, callback) {
};
request(teams_req, function (err, resp, body) {
if (resp.statusCode !== 200) {
return callback(new Error('Error retrieving teams from Github: ' + body || err));
return callback(new Error('Error retrieving teams from GitHub: ' + body || err));
}
user.awsRoleSession = user.nickname;
user.awsTagKeys = ['GithubTeam'];
var git_teams = JSON.parse(body).map(function (team) {
if (team.organization.login === "ministryofjustice") {
return team.slug;
}
}).filter(function(team) {
if(team === "all-org-members") {
return false;
}
return team;
});
user.GithubTeam = ":" + git_teams.join(":") + ":";
user.awsRole = rolePrefix + ':role/' + role + "," + samlIdP;
user.awsRole = rolePrefix + ':role/' + role + "," + samlIdP;
context.samlConfiguration.mappings = {
'https://aws.amazon.com/SAML/Attributes/Role': 'awsRole',
'https://aws.amazon.com/SAML/Attributes/RoleSessionName': 'awsRoleSession',
Expand Down

0 comments on commit feffd88

Please sign in to comment.