Skip to content

guardSvc.authorized ignores the required role #3

@wmlockhart

Description

@wmlockhart

Thank you for such an excellent resource.

The guardSvc.authorized function in features.html:

This paragraph will only show if you are currently signed in and the user is in the administrator role.

works for user authentication but doesn't check for authorisation (it appears to ignore the required role).

Would you please recommend how I could fix this issue. Thanks.

I would like to display a link in the horizontal navigation only when a user is authenticated and is authorised as a 'user' and a different link when a user is authorised as an Administrator. Would you please advise on how I could achieve this. Thanks again.

I added the resolve:

resolve: {
guard: ['guardSvc', function (guardSvc) {
return guardSvc.guardRoute(['administrator']);
}]
},

to the route. This secures the route from anonymous / non-authenticated users as expected but doesn't check for authorisation (as previous). When we fix the previous issue then I expect this will also work.

But I still can't figure out how I show / hide the link?

Thanks in advance.

Kind Regards

Walter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions