<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On 27 Sep 2006, at 4:17 AM, Larry Garfield wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">How well would this support more complex access rules?<SPAN class="Apple-converted-space">  </SPAN>Currently the end<SPAN class="Apple-converted-space"> </SPAN></FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">result is a boolean and that's all that's saved.<SPAN class="Apple-converted-space">  </SPAN>That allows for complex<SPAN class="Apple-converted-space"> </SPAN></FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">rules like:</FONT></P></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>The issue with a boolean like that however is that it's result is different for every single</DIV><DIV>user. This new menu system entirely removes the may_cache element, and is almost guaranteed</DIV><DIV>to be several orders of magnitude faster and less memory intensive. (disclaimer: 64.5% of statistics are made up on the spot). </DIV><DIV><BR><BLOCKQUOTE type="cite"> <P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">user_access('break things') || $uid=1 || $uid == $nid-&gt;uid</FONT></P></BLOCKQUOTE>You can still wrap this in a function and call it. This is sadly the only</DIV><DIV>way this can be done, due to php's unfortunate lack of support for closures.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">(or whatever).<SPAN class="Apple-converted-space">  </SPAN>How would we do similar compound access rules with this<SPAN class="Apple-converted-space"> </SPAN></FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">system?<SPAN class="Apple-converted-space">  </SPAN>It looks like it would only support a single function call, which is<SPAN class="Apple-converted-space"> </SPAN></FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">not always appropriate.</FONT></P> </BLOCKQUOTE><BR></DIV><DIV>I have a mechanism to allow multiple function calls, but it is still only for a limited amount of flexibility. It is built on the callback specification of forms api, and is formalised using a</DIV><DIV>function as a constructor. :</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>function cb($function) {</DIV><DIV>  $args = func_get_args();</DIV><DIV>  $callback = array_shift($args);</DIV><DIV>  $data['_properties_'] = array('type' =&gt; 'callback'));</DIV><DIV>  $data[microtime()] =&gt; array('callback' =&gt; $callback, 'arguments' =&gt; $args);</DIV><DIV>  return $data;</DIV><DIV>}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Which now allows you to do :</DIV><DIV>'access' =&gt; cb('function', 'arg') + cb('function', 'arg') + cb('function','arg')</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>In the data api, any property can be a callback instead of a value, in fact it's</DIV><DIV>preferred as callbacks can be cached, but values can't be.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR></BODY></HTML>