aws-samples / iam-identity-center-team

Open-source temporary elevated access solution for AWS IAM Identity Center.
https://aws-samples.github.io/iam-identity-center-team/
MIT No Attribution
295 stars 67 forks source link

feature: support unicode for comment and justification #192

Closed koh-sh closed 5 months ago

koh-sh commented 7 months ago

Issue #, if available: resolve https://github.com/aws-samples/iam-identity-center-team/issues/163

Description of changes: I changed regexp for validation of comment and justification to support unicode characters. So, users should be able to use Japanese and some other Asian languages.

I tested my regexp with some samples, please check if this is appropriate behavior.

Backend (click to open)

``` $util.matches("[\p{IsAlphabetic}\p{Digit}]", "A") ## upper -> true $util.matches("[\p{IsAlphabetic}\p{Digit}]", "a") ## lower -> true $util.matches("[\p{IsAlphabetic}\p{Digit}]", "1") ## number -> true $util.matches("[\p{IsAlphabetic}\p{Digit}]", "あ") ## Japanese -> true $util.matches("[\p{IsAlphabetic}\p{Digit}]", "아") ## Korean -> true $util.matches("[\p{IsAlphabetic}\p{Digit}]", "你") ## Chinese -> true $util.matches("[\p{IsAlphabetic}\p{Digit}]", " ") ## space -> false $util.matches("[\p{IsAlphabetic}\p{Digit}]", "!") ## symbol -> false $util.matches("[\p{IsAlphabetic}\p{Digit}]", " ") ## tab -> false $util.matches("[\p{IsAlphabetic}\p{Digit}]", "") ## empty -> false ```

Frontend (click to open)

``` bash-5.2$ cat t.js var arr = ['A', 'a', 1, 'あ', '아', '你', ' ', '!', ' ', '' ]; for (const elem of arr) { console.log(elem + ": " + /[\p{L}\p{N}]/u.test(elem)) } bash-5.2$ node t.js A: true a: true 1: true あ: true 아: true 你: true : false !: false : false : false bash-5.2$ ```

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

tawoyinfa commented 7 months ago

@koh-sh Thanks for the PR. We will review and merge asap

koh-sh commented 5 months ago

@maunzCache Is there anything else I need to do for this pull request? If everything looks good, I would appreciate it if you could merge it into the main branch.

tawoyinfa commented 5 months ago

@koh-sh and @maunzCache thanks for working on this. Please allow sometime for it to be reviewed internally and merged into the main code

maunzCache commented 5 months ago

@maunzCache Is there anything else I need to do for this pull request? If everything looks good, I would appreciate it if you could merge it into the main branch.

I have no permissions and affiliations with the project. Was just curious to see your change and help out tawoyinfa

koh-sh commented 5 months ago

@tawoyinfa Sorry, I thought he was one of the maintainers. Please review the pull request when you have time.

@maunzCache Still, thanks for the comment.

tawoyinfa commented 5 months ago

@koh-sh this code is now merged. Thanks for putting in the work