Thanks for the response Gil, But I was asking for applying multiple
conditions as mentioned below

<screen name="XerusHomePageDecorator">
    <section>
        <actions>
            <property-map resource="XerusThemeUiLabels"
map-name="uiLabelMap" global="true"/>
            <property-map resource="CommonUiLabels" map-name="uiLabelMap"
global="true"/>
            <set field="layoutSettings.companyName"
from-field="uiLabelMap.XerusThemeCompanyName" global="true"/>
            <set field="layoutSettings.styleSheets[]"
value="/xerusTheme/css/bootstrap.min.css"/>
           <set field="layoutSettings.javaScripts[+0]"
value="/xerusTheme/js/bootstrap.min.js" global="true"/>
        </actions>
        <widgets>
            <section>
<if>
   <condition>
     <if-has-permission permission="XERUS" action="_ADMIN"/>
   </condition>
 <then>
   <widgets>
     <platform-specific><html><html-template
location="component://xerusTheme/webapp/xerusTheme/includes/PreBody.ftl"/></html></platform-specific>
      <decorator-section-include name="pre-body"/>
      <decorator-section-include name="body"/>
     <platform-specific><html><html-template
location="component://xerusTheme/webapp/xerusTheme/includes/PostBody.ftl"/></html></platform-specific>
   </widgets>
 </then>
<else-if>
   <condition>
      <if-has-permission permission="XERUS_ASSETMAINTENANCE"
action="_VIEW"/>
   </condition>
 <then>
   <widgets>
      <decorator-screen name="main-decorator"
location="${parameters.mainDecoratorLocation}">
         <decorator-section name="body">
            <platform-specific>
               <html><html-template
location="component://xerus/webapp/xerus/crud/ListOfAssets.ftl"/></html>
            </platform-specific>
         </decorator-section>
      </decorator-screen>
   </widgets>
 </then>
</else-if>
<else-if>
   <condition>
      <if-has-permission permission="XERUS_PRODUCTION" action="_VIEW"/>
   </condition>
  <then>
    <widgets>
      <decorator-screen name="main-decorator"
location="${parameters.mainDecoratorLocation}">
       <decorator-section name="body">
          <platform-specific>
             <html><html-template
location="component://xerus/webapp/xerus/crud/ProductionView.ftl"/></html>
          </platform-specific>
       </decorator-section>
      </decorator-screen>
    </widgets>
  </then>
</else-if>
<else>
  <label style="h3">${uiLabelMap.XerusViewPermissionError}</label>
  <label style="h3">You are not allowed to view this page.</label>

</else>
</if>

</widgets>
 </section>
</screen>


but this is not working as I expected, please guide me if anywhere I'm
going wrong.

Best Regards,
Maheshwari.

On Tue, Apr 11, 2023 at 12:52 PM Gil Portenseigne <
gil.portensei...@nereide.fr> wrote:

> Hello Mahi,
>
> You can find multiple examples in the code base looking for :
> `<fail-widgets>`
>
> One of :
>
> <section>
>      <condition>
>          <if-service-permission
> service-name="workEffortGenericPermission" main-action="VIEW"/>
>      </condition>
>      <widgets>
>          <platform-specific><html><html-template
>
> location="component://workeffort/template/task/MyTasks.ftl"/></html></platform-specific>
>      </widgets>
>      <fail-widgets>
>          <label
> style="h3">${uiLabelMap.WorkEffortViewPermissionError}</label>
>      </fail-widgets>
> </section>
>
> If condition is true, widgets will display, else that will be fail-widgets
>
> Regards
>
> Gil
>
> Le 11/04/2023 à 09:08, Mahi maheshwari a écrit :
> > Hello Community,
> >
> > I want to add .ftl files in screens.xml for multiple users based on a few
> > conditions if there are multiple users named production user and quality
> > user and other users, so for this users if I want to give permission for
> > viewing any .ftl files, how can I do it.
> >
> > *for instance*, if production_user has permission to view only the
> > production module then render production.ftl ,  if quality_user has
> > permission to view only the quality module then render quality.ftl and if
> > assets_user has permission to view the assets module then render
> > assetmaint.ftl.
> > I want to give conditions like if else in one <screen> tag in screens.xml
> >
> > *example: *
> > in widgets/screens.xml
> > <screen name="screenName">
> > if(User has Production_View permission)
> > then
> > <html><html-template
> >
> location="component://xerus/webapp/xerus/crud/ProductionView.ftl"/></html>
> > else if(User has AssetMaintaince_View permission)
> > then
> > <html><html-template
> > location="component://xerus/webapp/xerus/crud/ListOfAssets.ftl"/></html>
> > else if(User has Quality_View permission)
> > then
> >      <html><html-template
> >
> location="component://xerus/webapp/xerus/crud/QualityMainPage.ftl"/></html>
> > else
> > <html><html-template
> > location="component://xerus/webapp/xerus/crud/NoPermission.ftl"/></html>
> > END of if
> > </screen>
> >
> > please let me know how can I achieve this.
> >
> >
> > Best Regards,
> > Maheshwari.
> >
>

Reply via email to