AnsweredAssumed Answered

Accessing user groups in share template

Question asked by tbrooks on Aug 14, 2013
Using the fme plugin module I've created my own data list that extends the base datalist model. I understand how the form gets rendered and how you apply the control template to display each field.  I now want to add my own control that filters out certain options in a drop down list based on the group that the current logged in user is part of.

I've copied the default selectone.ftl template and create a new template called deposit-selectone.ftl.

What I want to do is in this part here (where I want the if statement has *****):


<select id="${fieldHtmlId}" name="${field.name}" tabindex="0"
               <#if field.description??>title="${field.description}"</#if>
               <#if field.control.params.size??>size="${field.control.params.size}"</#if>
               <#if field.control.params.styleClass??>class="${field.control.params.styleClass}"</#if>
               <#if field.control.params.style??>style="${field.control.params.style}"</#if>
               <#if field.disabled  && !(field.control.params.forceEditable?? && field.control.params.forceEditable == "true")>disabled="true"</#if>>
               <#list field.control.params.options?split(optionSeparator) as nameValue>
                  <#if nameValue?index_of(labelSeparator) == -1>
                       <****if user is in group B and the field value != "pending" then don't diplay the option******>
                        <option value="${nameValue?html}"<#if nameValue == fieldValue?string || (fieldValue?is_number && fieldValue?c == nameValue)> selected="selected"</#if>>${nameValue?html}</option>
                    
                  <#else>
                     <#assign choice=nameValue?split(labelSeparator)>
                       <****if user is in group B and the field value != "pending" then don't diplay the option******>
                        <option value="${choice[0]?html}"<#if choice[0] == fieldValue?string || (fieldValue?is_number && fieldValue?c == choice[0])> selected="selected"</#if>>${msgValue(choice[1])?html}</option>
                  </#if>
               </#list>
         </select>
         <@formLib.renderFieldHelp field=field />



I'm a newbie to Alfresco and trying to understand the concepts is quite difficult based off of the documentation.

Appreciate the help

Outcomes