Skip to content
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

Epic: Add Angular Route Guards to manage navigation in app #142

Open
2 tasks
Michiel-s opened this issue Jan 23, 2023 · 3 comments
Open
2 tasks

Epic: Add Angular Route Guards to manage navigation in app #142

Michiel-s opened this issue Jan 23, 2023 · 3 comments
Assignees

Comments

@Michiel-s
Copy link
Member

Michiel-s commented Jan 23, 2023

In our frontend application we have two use cases that request for Route Gard implementation:

  • Ask user to save data when moving away from component when there are still uncommitted changes
  • Allow access to components based on Role based access constraint that come from Ampersand compiler

There are five different types of Route Guards:

  1. CanActivate
  2. CanActivateChild
  3. CanLoad
  4. CanDeactivate (can be used to prevent navigating away)
  5. Resolve

Note that a Route Guard can be applied to a route itself using the canActivate property and/or be applied to all child routes using the canActiveChild property.

{
   path: 'foo',
   canActivate: [AuthGuard],
   canActivateChild: [AuthGuard],
   component: FooComponent,
   children: [
    { path: ':id', component: BarComponent},
    { path: ':id/name', component: BazComponent}
]}

This feature requires the implementation of keeping track of sessionRoles in the frontend. I'll create a separate issue for that.

EDIT:

It is not necessary for the sessionRoles to be tracked in the front-end, since this has already been handled by the back-end.

To complete this Epic, there are two issues that have to be resolved. One involves routing based on the roles of the user AmpersandTarski/prototype-frontend#177, and the other involves the user going to another route when the changes have yet to be commited #136 .

@LiWeiYeh
Copy link
Contributor

@Michiel-s perhaps it's better to split this into multiple issues? For the "Ask user to save data when moving away from component when there are still uncommitted changes" part, I'm guessing that's for when the patches don't immediately get called, right? Cause that's also not possible yet in our current application.

@LiWeiYeh LiWeiYeh self-assigned this Feb 21, 2023
@LiWeiYeh LiWeiYeh changed the title Add Angular Route Guards to manage navigation in app Epic: Add Angular Route Guards to manage navigation in app Feb 21, 2023
@LiWeiYeh LiWeiYeh transferred this issue from AmpersandTarski/prototype-frontend Jul 10, 2023
@stefjoosten stefjoosten assigned Michiel-s and unassigned LiWeiYeh May 24, 2024
@stefjoosten
Copy link
Contributor

Is this issue still relevant? @Michiel-s can we close this?

@Michiel-s
Copy link
Member Author

Yes. This issue is still relevant. The developed RolesGuard is not activated for generated module and also the pending changes detection is open issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

3 participants