I recommend (in general, not just for your case) that people create subclasses of all 7 CSLA base classes. These subclasses are your base classes, from which your business objects derive.
This technique (even if these new base classes are empty), allows you to customize and extend CSLA behavior.
In your case, I specifically made CanReadProperty() and CanWriteProperty() virtual/Overridable so you could do what you want to do. And the way you tap into this extensibility, is by creating your own base classes that subclass my base classes.
There've been a couple other threads about this sort of thing - including a relatively recent one (1-2 weeks old) discussing the specific syntax needed to subclass the generic base classes provided by CSLA.
Yes, that is exactly correct. For instance:
[Serializable]
public abstract class MyBusinessBase<T> : BusinessBase<T> where T : MyBusinessBase<T>
{
}
Rocky,
Are you still considering implementing a Delegate for IsReadAllowed so that it would call a Function IsInRole(user As IPrincipal, role As String)?
We had discussed this about 6 weeks ago and you mentioned it was too late for version 2.1. I just want to know if you have followed up on the idea.
The benefit of this would be to allow people to use 99% of the CSLA framework for Authorization and still extend it. The alternative is a complete re-write of the Authorization (or use of AzMan or ...).
e.g. IsInRole returns True/False for the list of Roles. But I also have a list of Permissions and I want to be able to call user.HasPermission("somePerm"). If I Override CanReadProperty I can only call IsInRole. I can't call HasPermission without re-writing the CSLA Authorization code. By using a Delegate function deep in the framework, I should be able to call HasPermission without having to re-build what Rocky already built.
Joe
From: JoeFallon1 [mailto:cslanet@lhotka.net]
Sent: Thursday, October 05, 2006 7:58 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] CSLA & Authorization Manager (AzMan)Rocky,
Are you still considering implementing a Delegate for IsReadAllowed so that it would call a Function IsInRole(user As IPrincipal, role As String)?
We had discussed this about 6 weeks ago and you mentioned it was too late for version 2.1. I just want to know if you have followed up on the idea.
The benefit of this would be to allow people to use 99% of the CSLA framework for Authorization and still extend it. The alternative is a complete re-write of the Authorization (or use of AzMan or ...).
e.g. IsInRole returns True/False for the list of Roles. But I also have a list of Permissions and I want to be able to call user.HasPermission("somePerm"). If I Override CanReadProperty I can only call IsInRole. I can't call HasPermission without re-writing the CSLA Authorization code. By using a Delegate function deep in the framework, I should be able to call HasPermission without having to re-build what Rocky already built.
Joe
Copyright (c) Marimer LLC