<div>Hi Michael,</div>
<div>&nbsp;</div>
<div>Thanks for the reply. While waiting for a reply to my question, I came up with the following:</div>
<div>&nbsp;</div>
<div>...</div>
<div>when<br>&nbsp; c: PermissionCheck(name == &quot;stuff&quot;, action == &quot;do&quot;, granted = false)<br>&nbsp; AppProp(now == (new Date()), s: startDate -&gt; (s.getTime() &lt; now.getTime()), e: endDate -&gt; (e.getTime() &gt; 
now.getTime()) )<br>&nbsp; Role(name == &quot;A Role&quot;)<br>then<br>...</div>
<div>&nbsp;</div>
<div>Yours looks a lot simpler than mine, though :)</div>
<div>&nbsp;</div>
<div>Could you explain why the value of &quot;now&quot; would be what would be expected? Would it not be the time when the rule fires? I&#39;m a bit worried now :/</div>
<div>&nbsp;</div>
<div>Best Regards,</div>
<div>Kris<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 3/9/07, <b class="gmail_sendername">Michael Neale</b> &lt;<a href="mailto:michael.neale@gmail.com">michael.neale@gmail.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">hi Kris.<br><br>Well, you can&#39;t bind a variable to a new instance on the LHS - on the LHS you have no control over when conditions are evaluated, so the value of &quot;now&quot; would not necessarily be what you think. 
<br><br>Nevertheless, I can see what you want:<span class="q"><br><br><br>rule CanDoHisStuff<br>&nbsp; activation-group &quot;permissions&quot;<br>when<br>&nbsp; c: PermissionCheck(name == &quot;stuff&quot;, action == &quot;do&quot;, granted = false) 
<br><br></span>
<div>&nbsp; ap: AppProps(startDate &lt; ( now() ), endDate &gt; ( now() ) )<br>&nbsp; Role(name == &quot;A Role&quot;)<br><br>then<br>&nbsp; c.grant();<br>end;</div><br>this assumes you have a function :<br><br>function Date now() <br>
&nbsp;return new Date();<br>end<br><br>(I havent&#39; tested this, just a suggestion).<br><br><br>
<div>
<div><span class="e" id="q_11135836bed613e3_3"><span class="gmail_quote">On 3/8/07, <b class="gmail_sendername">Rented User</b> &lt;<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rented@gmail.com" target="_blank">
 rented@gmail.com</a>&gt; wrote:</span></span></div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<div><span class="e" id="q_11135836bed613e3_5">Hi,<br><br>I&#39;m mew to this rules stuff, and although I&#39;ve looked at rules engines such as Corticon before, I got introduced to JBoss Rules through JBoss Seam&#39;s security mechanism. 
<br><br>I&#39;m trying to expand on Seam&#39;s built in functionality to assess a user&#39;s permissions. My use case is that a user of the system may or may not have permission to a resource based on the user&#39;s role AND the current date. The system accepts certain actions only if &quot;now&quot; is between a certain start and end date. What I&#39;d like to do is something like this: 
<br><br>rule CanDoHisStuff<br>&nbsp; activation-group &quot;permissions&quot;<br>when<br>&nbsp; c: PermissionCheck(name == &quot;stuff&quot;, action == &quot;do&quot;, granted = false)<br>&nbsp; now: new Date()&nbsp; &lt;--------------------------------------------------------------How can I accomplish this? 
<br>&nbsp; ap: AppProps()<br>&nbsp; Role(name == &quot;A Role&quot;)<br>&nbsp;eval(now &gt;= ap.startDate, now &lt;= ap.endDate)&nbsp; <br>then<br>&nbsp; c.grant();<br>end;<br><br>Now, I understand that in my code, I could assert an object &quot;now&quot;. However, a lot of the security is hidden behind the scenes in Seam. For example, this rules will be fired from an XML definition file. 
E.g.<br><br>&nbsp;&nbsp;&nbsp; &lt;page view-id=&quot;/restricted/doStuff.xhtml&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;restrict&gt;#{s:hasPermission(&#39;stuff&#39;, &#39;do&#39;, null)}&lt;/restrict&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;navigation from-action=&quot;#{ 
createStuffManager.yesConfirmSave}&quot;&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;end-conversation/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;redirect view-id=&quot;/restricted/viewStuff.xhtml&quot;/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/navigation&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/page&gt;<br>
<br>While I could start extending Seam&#39;s security model, that seems a bit invasive for such a simple task.<br><br>Thanks<br><br>/Kris<br><br><br><br><br></span></div>_______________________________________________<br>
rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div><br><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br><br></blockquote></div><br>