-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1964 - Added role to restrict MSFAA reissue #1985
#1964 - Added role to restrict MSFAA reissue #1985
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice start, please take a look at the comments.
I believe that we need to include in this ticket the API endpoint decorator and disable/remove the MSFAA button from the form when the user does not have the role.
…for the endpoint;
@@ -30,4 +30,5 @@ export enum Role { | |||
InstitutionCreateNote = "institution-create-note", | |||
InstitutionApproveDeclineDesignation = "institution-approve-decline-designation", | |||
InstitutionApproveDeclineOfferingChanges = "institution-approve-decline-offering-changes", | |||
StudentReissueMSFAA = "student-reissue-msfaa", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adding <check-permission-role>
in the vue side. I know the Vue button is inside form.io. But is there a way to disable the button when the user does not have right permission?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm working on that. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the test/
dir be named as _tests_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it to the same directory as auth.e2e-spec.ts and institution.e2e-spec.ts. What do you guys think @dheepak-aot @andrewsignori-aot @guru-aot @sh16011993 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our application we do not follow the test
package at root pattern like typically what OOTB code template creates.
I would suggest this e2e-spec to be in $same_directory_of_code_which_is_tested/tests/auth.aest.e2e-spec.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the application structure, I believe the directory should be renamed to _tests_
and the test should be moved to the directory of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I moved that test to the same directory of aest-token-helpers.ts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a minor comment
...apps/api/src/route-controllers/application/_tests_/application.aest.reissueMSFAA.e2e-spec.ts
Outdated
Show resolved
Hide resolved
Looks good @andrepestana-aot . Just one comment on have Also, please add the role name |
...apps/api/src/route-controllers/application/_tests_/application.aest.reissueMSFAA.e2e-spec.ts
Outdated
Show resolved
Hide resolved
...ackend/apps/api/src/testHelpers/auth/_tests_/e2e/aest-token-helpers.getAESTToken.e2e-spec.ts
Show resolved
Hide resolved
@@ -12,7 +12,7 @@ | |||
</template> | |||
<notice-of-assessment-form-view | |||
:assessment-id="assessmentId" | |||
:can-reissue-m-s-f-a-a="true" | |||
:can-reissue-m-s-f-a-a="hasStudentReissueMSFAARole" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that usually, the vue is disabling the component instead of hiding it. For this case to keep it simple I would no mind having it removed.
...apps/api/src/route-controllers/application/_tests_/application.aest.reissueMSFAA.e2e-spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work @andrepestana-aot 👍
|
||
const jwtService = new JwtService(); | ||
|
||
describe("(e2e)-getAESTToken()", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend using the "Auth" as a prefix, like Auth(e2e)-getAESTToken()
.
|
||
describe("(e2e)-getAESTToken()", () => { | ||
it("Should have all roles when ministry user is a business administrator.", async () => { | ||
//Act |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please change it to "// Act"?
decodedToken.resource_access.aest.roles.sort((a, b) => a.localeCompare(b)); | ||
const allAESTRoles = Object.values(Role).sort((a, b) => a.localeCompare(b)); | ||
|
||
//Assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please change it to "// Assert"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing the changes, look good 👍
SonarCloud Quality Gate failed.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes and adding role name to ticket. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank You for making the changes. LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice work @andrepestana-aot
Auth Ministry
√ Should have specific roles when ministry user is a business administrator. (400 ms)
ApplicationAESTController(e2e)-reissueMSFAA
√ Should not reissue an MSFAA when user is not a business administrator.