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)
atlassian-bamboo.log
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
PostBuildForAction.java
public class PostBuildForAgentAction extends BaseConfigurablePlugin implements CustomBuildProcessor {
....
....
public static final String FOR_ADMIN = "custom.company.for.admin";
public static final String DISABLE_SCANNER = "custom.company.for.disable.scanner";
public static final String DISABLE_BREAKER = "custom.company.for.disable.build.breaker";
....
@Override
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(DISABLE_BREAKER,buildConfiguration.getString(DISABLE_BREAKER));
context.put(DISABLE_SCANNER,buildConfiguration.getString(DISABLE_SCANNER));
context.put(FOR_ADMIN, isAdmin?"true":"false");
context.put("filterList", dataList);
And finally my template
[@ui.bambooSection title='Scanner' ]
[#if (plan.buildDefinition.customConfiguration.get('custom.company.for.admin'))?has_content ]
[@ww.checkbox label='Disable Scanner ' name='custom.company.for.disable.scanner' toggle='true' /]
[@ww.checkbox label='Disable Breaker ' name='custom.company.for.disable.build.breaker' toggle='true' /]
[/#if]
[@ww.select label="Filter" name="custom.company.for.filter" required='false' list=filterList listKey="value" listValue="displayName" /]
[/@ui.bambooSection]
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…