Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] Re: JEXL With Conditionals in

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] Re: JEXL With Conditionals in

Chronological Thread 
  • From: Chris Hyzer <>
  • To: Colin Hudler <>, "" <>
  • Subject: RE: [grouper-users] Re: JEXL With Conditionals in
  • Date: Fri, 11 Jun 2010 15:12:54 -0400
  • Accept-language: en-US
  • Acceptlanguage: en-US

Well, the custom method doesn't work in jexl if not registered with the
context. So I added support in Grouper 1.6 just to load classes if not
registered (otherwise we would need a callback to register things). This is
fine for things in the server side configs, but now that users can customize
their simple membership update screen, its not secure to allow them to call
any static method in an EL. So this defaults to not allowed, and if we need
it somewhere where we use EL, we can turn it on. I did change the
substituteExpressionLanguage method to handle curlies in scripts in 1.6...
here is the test case

* @param group
* @return string
public static String transformGroup(Group group) {
return "hey: " + group.getNameDb();

public void testSubstituteExpressionLanguage() {
Group group = new Group();
Map<String, Object> substituteMap = new HashMap<String, Object>();
substituteMap.put("group", group);
String nameDb = null;

nameDb = GrouperUtil.substituteExpressionLanguage("${group.nameDb}
${group.nameDb}", substituteMap);
assertEquals("someName someName", nameDb);

try {
nameDb =
fail("Shouldnt get here");
} catch (Exception e) {

nameDb =
substituteMap, true);
assertTrue(Long.parseLong(nameDb) > 0);
nameDb =
substituteMap, true);
assertEquals("hey: someName", nameDb);

nameDb = GrouperUtil.substituteExpressionLanguage("${if (true) { 'hello';
} } ${group.nameDb}", substituteMap);
assertEquals("hello someName", nameDb);
nameDb = GrouperUtil.substituteExpressionLanguage("${if (true) { if
(true){ 'hello'; }}} ${group.nameDb}", substituteMap);
assertEquals("hello someName", nameDb);
nameDb = GrouperUtil.substituteExpressionLanguage("${if (true) { if
(true){ 'hello'; }}} ${if (true) { if (true){ 'hello'; }}} ${group.nameDb}",
assertEquals("hello hello someName", nameDb);

-----Original Message-----
From: Colin Hudler

Sent: Friday, June 11, 2010 1:35 PM

Subject: Re: [grouper-users] Re: JEXL With Conditionals in

On 06/11/2010 12:16 PM, Chris Hyzer wrote:
> I didn't really expect complex scripts with curlies... whoops. Btw,
> Grouper 1.6 has jexl2...

Okay, for my simple needs in this case, jexl2 will work, since I can write

${empty subject.attr ? 'has it' : 'does not have it' }

instead of if () [else] with the curlies.

Also, thanks for the suggestions. I think I might just try a custom
method, or somehow make the need for it disappear.

Archive powered by MHonArc 2.6.16.

Top of Page