Checking if a context variable is boolean true/false in a FTL (freemarker template)

I have built a build processor that has some UI pieces… A User can update some settings when they are configuring a plan, focused on a job, and click on the Miscellaneous tab…

In my code, i make a check to see if they are a bamboo admin (or something equivalent to an admin)

In my FTL i want to check that variable and if is ‘true’ then display additional settings, if ‘false’ then skip them…

I don’t get any template errors in my log, and i know the admin variable is getting set to true (string)


2018-03-27 10:58:41,888 DEBUG [http-nio-8085-exec-26] [PostBuildForAgentAction] Set Bamboo Authentication Context
2018-03-27 10:58:41,890 INFO [http-nio-8085-exec-26] [PostBuildForAgentAction] User invoked it : AdminUser
2018-03-27 10:58:41,890 DEBUG [http-nio-8085-exec-26] [PostBuildForAgentAction] Set Bambooo Permission Manager
2018-03-27 10:58:41,903 DEBUG [http-nio-8085-exec-26] [PostBuildForAgentAction] Admin members
2018-03-27 10:58:41,906 DEBUG [http-nio-8085-exec-26] [PostBuildForAgentAction] Current User AdminUser
2018-03-27 10:58:41,906 DEBUG [http-nio-8085-exec-26] [PostBuildForAgentAction] Is an admin? true

public class PostBuildForAgentAction extends BaseConfigurablePlugin implements CustomBuildProcessor {
         public static final String FOR_ADMIN = "";
         public static final String DISABLE_SCANNER = "";
         public static final String DISABLE_BREAKER = "";

    protected void populateContextForEdit(@NotNull final Map<String, Object> context, @NotNull final BuildConfiguration buildConfiguration, @Nullable final Plan plan) {
        boolean isAdmin = bambooPermissionManager.isAdmin(user);
        log.debug ("Current User " + user );
        log.debug ("Is an admin? " + Boolean.toString(isAdmin));
        context.put(FOR_ADMIN, isAdmin?"true":"false");
        context.put("filterList", dataList);

And finally my template

[@ui.bambooSection title='Scanner' ]

    [#if (plan.buildDefinition.customConfiguration.get(''))?has_content ]
        [@ww.checkbox label='Disable Scanner ' name='' toggle='true' /]
        [@ww.checkbox label='Disable Breaker ' name='' toggle='true' /]

    [ label="Filter" name="" required='false' list=filterList listKey="value" listValue="displayName" /]


Esssentially as an admin logged it, i should see 2 checkboxes and a dropdown… and I am only seeing the drop down (select).

i have tried ?? ?has_content ?boolean, i have set the values to true/false, True/False, True/"", true/""

any help/suggestion would greatly be appreciated…

Ok think i understand what might be going on…

Can someone please verify for me… If i set


I can display or evaluated the value in the FTL with

[#if (${'VARNAME'})?hasContent ]
  Value is ${'VARNAME'}

Or how do you get it?