Forum OpenACS Development: How to customize list from listbuilder depending on user privilege

Hi all,
I want to make bulk actions and actions and some extra columns for each row like a delete link only available if the user is an admin.

How can I create my list depending on a is_admin_p parameter without copy and past the full list create block?

Greetings,
Nima

Without testing: Create a custom "list create block" in a variable. Append to this variable all the definitions you want to have. Call listbuilder with this variable.

Here is some dummy code:

if $admin_p {
set element_code "[list label "delete" ....]\n"
} else {
set element_code ""
}

Look at the elements definition in file-storage/www/folder-chunk.tcl.

Before the last "]" you just add "$element_code" on a new line, and off you (should) go.

Nima,

Malte is right :) I do a bunch of this in file-storage on the oacs-5-1 branch.

First I create a list of bulk actions based on permissions and pass that into the template::list::create call.

I also create the elements block as a list.