We are using
providers: [
hookRoute({
label: ‘Device Configuration’,
path: ‘device-dashboard’,
icon: ‘gears’,
context: ViewContext.Device,
component: deviceConfigurations,
priority: 3000,
}),
],
At device level, the Dashboard and its link should only be displayed when a condition is met, such as when the device type or device name matches. For example, if there are two types of dashboards—Type 1 and Type 2—the user should only see the link dashboard for Type 1 devices matches with its type or name.
The route interface provides the property canActivate
which expects a function or class which implements the canActivate
interface to check if a user has the permission to access the requested route.
It is common Angular functionality and not specific to Cumulocity: CanActivate • Angular
If you implement the canActivate
function, you can use the route: ActivatedRouteSnapshot
to access potential ManagedObject (such as device information) from the route and check if the device is of a specifc type.
3 Likes
In addition to what @Christian_Guether1 said, you can also just check the sample that we provide as part of the tutorial app.
1 Like
The issue is resolved now, and it’s working perfectly. Thank you!