AnsweredAssumed Answered

Access to JavaScript API from .ftl

Question asked by damiar on Jan 13, 2009
Latest reply on Jan 14, 2009 by damiar
Hi all,

I want to know if the user that is currently executing the webscript has "Write" permission over some folder.

Here is some code of I would like to do (FTL):

      <#list nodes as child>
           <readOnly><![CDATA[${ child.hasPermission("Write") }]]></readOnly>

Of course this code does not work (syntax error on child.hasPermission), but I cannot figure out of what should I do in order to know if the user can or cannot write on a folder.

I've tried to itearate over the "nodes" array that I'm using on the FTL and manually set a custom property that tell me if the user can write on the folder, here's the code:

  for each (var child in children) {
    logger.log( + " : " + child.hasPermission("Write")); = !child.hasPermission("Write");
  model.nodes = children;

But the problem is that if the user cannot write on a folder (I mean the user has no write permissions) the line " = …"  won't work. Actually I'm getting an error in the FTL that tells me that the property readOnly doesn't exists if the user cannot write in the folder, but the scripts works fine if he can write on the them.

What can I do? Any ideas?