<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.lhotka.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>CSLA .NET discussion</title><link>http://forums.lhotka.net/forums/5.aspx</link><description>General discussion about CSLA .NET</description><dc:language /><generator>CommunityServer 2008.5 SP3 (Build: 36.8414)</generator><item><title>Re: Property/Method Authorizations are not quite dynamic enough</title><link>http://forums.lhotka.net/forums/thread/44171.aspx</link><pubDate>Mon, 02 Aug 2010 19:04:57 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:44171</guid><dc:creator>JonStonecash</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/44171.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=44171</wfw:commentRss><description>&lt;p&gt;Do I love this forum or what?&amp;nbsp; Read the referenced post, agreed with the direction, but overrode the can read and can write properties, and all in time to do my demo in about 10 minutes.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Jon Stonecash&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: Property/Method Authorizations are not quite dynamic enough</title><link>http://forums.lhotka.net/forums/thread/44169.aspx</link><pubDate>Mon, 02 Aug 2010 18:50:36 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:44169</guid><dc:creator>JonnyBee</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/44169.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=44169</wfw:commentRss><description>&lt;p&gt;Hi Jon,&lt;/p&gt;
&lt;p&gt;See this discussion too: http://forums.lhotka.net/forums/t/9301.aspx?PageIndex=1 &lt;/p&gt;
&lt;p&gt;However, for now at least, you can override CanWriteProperty, CanReadProperty and CanExecuteMethod like this to make it dynamic:&lt;/p&gt;
&lt;pre style="font-family:consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="color:#cc7832;"&gt;override&lt;/span&gt;&amp;nbsp;&lt;span style="color:#cc7832;"&gt;bool&lt;/span&gt;&amp;nbsp;CanWriteProperty(Csla.Core.&lt;span style="color:#2b91af;"&gt;IPropertyInfo&lt;/span&gt;&amp;nbsp;property)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#004000;"&gt;//&amp;nbsp;must&amp;nbsp;override&amp;nbsp;so&amp;nbsp;that&amp;nbsp;authorization&amp;nbsp;rules&amp;nbsp;are&amp;nbsp;not&amp;nbsp;cached&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="color:#ffc66d;"&gt;BusinessRules&lt;/span&gt;.HasPermission(&lt;span style="color:#ffc66d;"&gt;AuthorizationActions&lt;/span&gt;.WriteProperty,&amp;nbsp;property);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/pre&gt;
&lt;pre style="font-family:consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="color:#cc7832;"&gt;override&lt;/span&gt;&amp;nbsp;&lt;span style="color:#cc7832;"&gt;bool&lt;/span&gt;&amp;nbsp;CanReadProperty(Csla.Core.&lt;span style="color:#2b91af;"&gt;IPropertyInfo&lt;/span&gt;&amp;nbsp;property)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#004000;"&gt;//&amp;nbsp;must&amp;nbsp;override&amp;nbsp;so&amp;nbsp;that&amp;nbsp;authorization&amp;nbsp;rules&amp;nbsp;are&amp;nbsp;not&amp;nbsp;cached&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="color:#ffc66d;"&gt;BusinessRules&lt;/span&gt;.HasPermission(&lt;span style="color:#ffc66d;"&gt;AuthorizationActions&lt;/span&gt;.ReadProperty,&amp;nbsp;property);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Property/Method Authorizations are not quite dynamic enough</title><link>http://forums.lhotka.net/forums/thread/44168.aspx</link><pubDate>Mon, 02 Aug 2010 18:39:47 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:44168</guid><dc:creator>JonStonecash</dc:creator><slash:comments>0</slash:comments><comments>http://forums.lhotka.net/forums/thread/44168.aspx</comments><wfw:commentRss>http://forums.lhotka.net/forums/commentrss.aspx?SectionID=5&amp;PostID=44168</wfw:commentRss><description>&lt;p&gt;Rocky,&lt;/p&gt;
&lt;p&gt;We are doing what is essentially a claims-based authorization scheme for object, object properties, and object methods.&amp;nbsp; Specifically, for properties and methods, we want to allow/disallow access based upon the contents of the object. &amp;nbsp;&amp;nbsp; We have a set of authorization rules that determine the authorization permissions 
for one property based upon contents of other properties in the same 
object.&amp;nbsp; This works just fine.&amp;nbsp; We bring up an object and buttons, text boxes, and so on behave as desired.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The problem comes in those cases that we allow the user to change the contents of the object properties.&amp;nbsp; We wanted to demonstrate to our client that the authorization changes when the contents of the object changes, but we ran into a problem.&amp;nbsp; Csla caches the property and method authorization rules/results for each object.&amp;nbsp; Under normal circumstances that increases performance, but it does get in the way of a cool demo. &lt;/p&gt;
&lt;p&gt;Note, that if we exit the form and return, the authorization rules are applied properly.&amp;nbsp; It is just when we are dynamically changing the object that we have a problem.&amp;nbsp; It might be argued that the new rules should not be applied until the object is saved, but I would disagree.&amp;nbsp; It might well be the case that the user is about to enter/change data that would make it impossible to change the object afterward; that would be a serious &amp;quot;oops&amp;quot;.&lt;/p&gt;
&lt;p&gt;The only time that Csla resets the cache is when the application principal changes.&amp;nbsp; This seems like a hold over from a role based authorization scheme and not in keeping with a claims-based approach.&lt;/p&gt;
&lt;p&gt;What I would like is a means to either force the cache to clear, say, with a protected method.&amp;nbsp; I would not need this capability for every class and perhaps not in all circumstances.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Could we look forward to such an addition?&lt;/p&gt;
&lt;p&gt;Jon Stonecash&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>