Home › Forums › Development › Hiding/Showing a workspace in the navigation bar based on a permission
- This topic has 7 replies, 2 voices, and was last updated 1 year, 1 month ago by stephane.lachance.
-
AuthorPosts
-
-
September 26, 2023 at 12:16 pm #23704Max WidmaierParticipant
We are trying to add a workspace that would be visible only if a user has a certain permission. This works for the imports:ImportProcess and mda:Campaign workspaces; however, I cannot find any option/parameter to make a workspace visible based on permissions. Is this some sort of framework option? Does it have to do with some sort of database column or something?
Thank you!
0 -
September 26, 2023 at 12:20 pm #23713Max WidmaierParticipant
I just found a column in the workspaces table called viewprivilege. Is there any way to specify this? Or does there need to be some sort of database upgrade?
0 -
September 26, 2023 at 12:42 pm #23721stephane.lachanceParticipant
Hi Max,
The visibility of a workspace is driven off a specific privilege granted to the logged-in user. The general rule is as follows:
- The logged-in user must be granted the privilege of the PortletRef marked as required contained within the workspace.
In more specific cases:
- A PortletRef can be marked as required and a privilege can be explicitly assigned to that portlet.
- A Navigator portlet is implicitly considered to be marked as required and, similarly, a privilege can be explicitly assigned.
- In this special case, sometimes the privilege to grant is implied through the read event needed to load the data table. This is in place for the Campaign workspace.
- Ie. The navigator data table reads the Campaign metaclass while its ‘read event explicitly requires the CampaignView privilege.
- In this special case, sometimes the privilege to grant is implied through the read event needed to load the data table. This is in place for the Campaign workspace.
0 -
September 26, 2023 at 3:36 pm #23729Max WidmaierParticipant
Thank you very much!
0 -
September 26, 2023 at 4:46 pm #23737Max WidmaierParticipant
It doesn’t seem to work…
The workspace doesn’t have a navigation portlet, so I added a required “PermissionPortlet”. The portlet doesn’t render without the permission but the workspace in the sidebar still appears.So I have:
<Portlet privilege=”PermissionName”>
<Composite name=”nothing”/>
</Portlet>With the workspace being:
<Workspace caption=”ids.caption” icon=”icon”>
<Page name=”pageContent”>
<Tab caption=”ids.some.other.caption” name=”tab”>
<PortletRef name=”refReactApp” portlet=”react/portlet”/>
<PortletRef name=”permissionPortlet” portlet=”bgm:PermissionPortlet” required=”true”/>
</Tab>
</Page>
</Workspace>0 -
September 26, 2023 at 4:58 pm #23745stephane.lachanceParticipant
Hi Max,
There’s a working example of this pattern included in the core CRM product already. Take a look at how the mda:engage:Nudge workspace is implemented with the mda:engage:NudgeFooter portlet.
0 -
September 26, 2023 at 7:54 pm #23753Max WidmaierParticipant
Ok thank you! That seems to have worked!
0 -
September 26, 2023 at 9:01 pm #23761stephane.lachanceParticipant
Any idea what you had to modify/add in your implementation? At a quick glance, I don’t see many differences from the snippets you provided earlier.
0
-
-
AuthorPosts
- You must be logged in to reply to this topic.