Very often we need to provide a link that redirects to an external link like Company Website, to be accessed by the portal users on the Microsoft Dynamics 365 Portal.
However, in some cases, we need to restrict the access to those external links based on the Roles assigned to the portal user or depending on whether the users are authenticated users or non-authenticated users.
Some of the examples for this could be we want to restrict the access to ‘API Documentation’ link if;
- the portal user does not have a specific role say ‘Premium Users’ role OR
- the portal user is not authenticated to portal OR
- perhaps the other way round, only if the portal user has not signed-in show the link
Hiding links in the Microsoft Dynamics 365 Portal:
It is very easy to hide web links to web pages using Access control Rule entity.
We just need to create new Access Control Rule entity record for that web page with Restrict Read right and add roles we need to provide access to the web page.
To know more about Access Control Rule refer this link.
Note: There is no direct way available to apply access rules on web links that open external links.
Workaround to apply Access Rules on Web Link that redirects to an external link:
- Open Web link record and add the external URL. In this example, we have opened the ‘API Documentation’ Web Link and added the external URL as ‘http://www.inogic.com/’ as seen in the screenshot below;
2. Select the Web Page lookup and create new web page entity record with a blank ‘Page Template’. In this example, we have created ‘API Documentation Blank Page’ and selected the ‘Page Template’ as ‘Blank’ as seen in the screenshots below;
3. Now, create a new ‘Web Page Access Control Rule’, select ‘API Documentation Blank Page’ as a ‘Web Page’ and add appropriate ‘Web Roles’ (like Authenticated Users, Administrators) that you want to grant access. Then add ‘Publishing States’ as ‘Published’.
4. Now, Select this newly created web page on the ‘API Documentation’ Web Link and save the Web Link record as seen in the screenshot below;
5. By following the steps mentioned above, we can easily apply Access Rule on Web Links with external links.
6. With the above configuration, the API Documentation link will only be displayed when the user logs in to the portal as seen in the screenshots below;
In a nutshell, to apply access control rule for WEB LINKS that are to an external page, we could create a WEB PAGE record and apply the rule to the WEB PAGE and have it trickle down to the WEB LINK.