I am continuing to implement privilege checking in our plugin. I want some of our components, such as the manage tab for the object view to only appear when the user has a specified privilege. Since we didn't want to use sub-tabs because we are using the HTML Bridge and decided to implement our own sub-tab structure with our html/javacript code, we are using a custom object view template.
In our DataAdapter we handle the +grantedPrivileges +property request. When this request is made, our code will return a list of Strings containing the list of privilges that the user has, and it does return the privilege that should allow the user to view our tab. Unfortunately even when the user has the privilige (i.e. we return the privilege string for grantedPrivileges), the manage tab does not appear.
In my plugin.xml file I have the following, which contains the privilege tags:
<template id="com.mycompany.objectViewTemplate">
<variable name="namespace" required="true"/>
<variable name="objectType" required="true"/>
<!-- Object tabs -->
<extensionPoint id="$.views"></div><div> <objectType class="com.vmware.ui.views.ViewSpec"/></div><div> </extensionPoint></div><div> <!-- Summary views --></div><div> <extensionPoint id="$.summaryViews">
<objectType class="com.vmware.ui.views.ViewSpec"/>
</extensionPoint>
<!-- Monitor views -->
<extensionPoint id="$.monitorViews"></div><div> <objectType class="com.vmware.ui.views.ViewSpec"/></div><div> </extensionPoint></div><div> <!-- Manage views --></div><div> <extensionPoint id="$.manageViews">
<objectType class="com.vmware.ui.views.ViewSpec"/>
</extensionPoint>
<!Extension point for columns>
<extensionPoint id="$.list.columns"></div><div> <objectType class="com.vmware.ui.lists.ColumnSetContainer"/></div><div> </extensionPoint></div><div> </div><div> <!-- Object view --></div><div> <extension id="$.view">
<extendedPoint>vsphere.core.inventory.serverObjectViews</extendedPoint>
<hostedPoint>$.views</hostedPoint></div><div> <object></div><div> <componentClass className="com.vmware.vsphere.client.views.ObjectTabbedView"/></div><div> </object></div><div> <metadata></div><div> <objectType>$</objectType></div><div> </metadata></div><div> </extension></div><div> </div><div> <!-- Summary tab --></div><div> <extension id="$.summary">
<extendedPoint>$.views</extendedPoint></div><div> <hostedPoint>$.summaryViews</hostedPoint>
<object>
<name>#</name>
<componentClass className="com.vmware.vsphere.client.views.NestedObjectView"/>
</object>
<metadata>
<objectType>$</objectType></div><div> * <privilege>MyPrivilege.readonly</privilege>*</div><div> </metadata></div><div> </extension></div><div> </div><div> </div><div> <!-- Manage tab --></div><div> <extension id="$.manage"></div><div> <extendedPoint>$.views</extendedPoint></div><div> <hostedPoint>$.manageViews</hostedPoint></div><div> <precedingExtension>$.summary</precedingExtension></div><div> <object></div><div> <name>#</name></div><div> <componentClass className="com.vmware.vsphere.client.views.NestedObjectView"/></div><div> </object></div><div> <metadata></div><div> <objectType>$</objectType>
<privilege>MyPrivilege.readwrite</privilege>
</metadata>
</extension>
<!Extension for various lists in the application.>
<extension id="$.list"></div><div> <extendedPoint>vise.inventory.lists</extendedPoint></div><div> <hostedPoint>$.list.columns</hostedPoint>
<object>
<componentClass>
<className>com.vmware.ui.lists.ListView</className>
<object>
<root>
<dragAndDropEnabled>true</dragAndDropEnabled>
</root>
</object>
</componentClass>
</object>
</extension>
<!-- Related Items tab.-->
<extension id="$.related"></div><div> <extendedPoint>$.views</extendedPoint>
<precedingExtension>$.manage</precedingExtension>
<object>
<name>#</name>
<componentClass>
<className>com.vmware.vsphere.client.views.RelatedItemsView</className>
<object>
<root>
<showTitleForSingleRelation>true</showTitleForSingleRelation>
</root>
</object>
</componentClass>
</object>
<metadata>
<objectType>$</objectType>
</metadata>
</extension>
</template>
<!-- End Template Definition -->
Also in the plugin.xml file:
<templateInstance id="com.mycompany.vcenterWebClientui.myObjectType.viewTemplateInstance">
<templateId>com.mycompany.objectViewTemplate</templateId>
<variable name="namespace" value="com.mycompany.vcenterWebClientui.myObjectType"/>
<variable name="objectType" value="eseries:StorageSystem"/>
<!-- remove the Related Objects tab since it is empty -->
<excludedExtension>com.mycompany.vcenterWebClientui.myObjectType.related</excludedExtension>
</templateInstance>
And there is this section in the plugin.xml file as well, where the templates are used. I tried putting the <privilege> tags here in these references, but that didn't seem to work and had even worse results. Even if only one tab sections had a <privilege> tag, none of the tab would appear.
<!-- Summary View -->
<extension id="com.mycompany.vcenterWebClientui.myObjectType.SummaryView">
<extendedPoint>com.mycompany.vcenterWebClientui.myObjectType.summaryViews</extendedPoint>
<object>
<name>#{myObjectType.summary.view}</name>
<componentClass className="com.vmware.vsphere.client.htmlbridge.HtmlView">
<object>
<root>
<url>/vsphere-client/vcenterWebClient-ui/redirect.html?page=mySummaryPage</url>
</root>
</object>
</componentClass>
</object>
</extension>
<!-- Management View -->
<extension id="com.mycompany.vcenterWebClientui.myObjectType.ManageView">
<extendedPoint>com.mycompany.vcenterWebClientui.myObjectType.manageViews</extendedPoint>
<object>
<name>#{myObjectType.manage.view}</name>
<componentClass className="com.vmware.vsphere.client.htmlbridge.HtmlView">
<object>
<root>
<url>/vsphere-client/vcenterWebClient-ui/redirect.html?page=myManagementPage</url>
<legacyScriptPlugin>true</legacyScriptPlugin>
<showVCenterSelector>true</showVCenterSelector>
</root>
</object>
</componentClass>
</object>
</extension>
Any help would be greatly appreciated.