Skip to content

Commit

Permalink
case sensitivity on user emails (#93)
Browse files Browse the repository at this point in the history
* removed case sensitivity on user emails while listing bindings

* chore(workflow): add for access-management

* resolve build conflicts

* fix workflow

* added lowercasing to emails

* reverted

* removed redundant lowercase

* reverted changes

* added branch to build

* arbitrary change

* removed branch name from gthub workflow

* removed arbitrary comment

Co-authored-by: Mathis Marcotte <mathis.marcotte@statcan.gc.ca>
Co-authored-by: Jose Matsuda <jose.matsuda@statcan.gc.ca>
Co-authored-by: Jose-Matsuda <jose.matsuda@canada.ca>
  • Loading branch information
4 people authored Sep 20, 2022
1 parent 689f07c commit f02e4d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/centraldashboard/app/api_workgroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class WorkgroupApi {
let errIndex = 0;
try {
const binding = mapSimpleBindingToWorkgroupBinding({
user: contributor,
user: contributor.toLowerCase(),
namespace,
role: 'contributor',
});
Expand Down Expand Up @@ -277,6 +277,7 @@ export class WorkgroupApi {
const profile = req.body as CreateProfileRequest;
try {
const namespace = profile.namespace || req.user.username;
const owerName = profile.user || req.user.email;
// Use the request body if provided, fallback to auth headers
await this.profilesService.createProfile({
metadata: {
Expand All @@ -285,7 +286,7 @@ export class WorkgroupApi {
spec: {
owner: {
kind: 'User',
name: profile.user || req.user.email,
name: owerName.toLowerCase(),
}
},
});
Expand Down
1 change: 1 addition & 0 deletions components/centraldashboard/app/attach_user_middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export function attachUser(
email = req.header(userIdHeader).slice(userIdPrefix.length);
auth = {[userIdHeader]: req.header(userIdHeader)};
}
email = email.toLowerCase();
req.user = {
email,
username: email.split('@')[0],
Expand Down

0 comments on commit f02e4d1

Please sign in to comment.