> -----Original Message----- > From: Chris Tilley [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 05, 2006 7:37 AM > To: CF-Talk > Subject: Re: Object Oriented Role Base Security > > Jim, > > I'd love to see your sample application.
I've uploaded it here: http://www.depressedpress.com/Test/DPSecurity/DPSecurity.zip This is an old version I made - it's stripped down as much as I could and I'm almost positive it works. ;^) The zip includes the needed libraries, but they need to be set up to use. Here are instructions for that: http://www.depressedpress.com/Content/Development/ColdFusion/DPLibraries/Art icles/General_Setup In short a CF Mapping to the folder "cfc_DepressedPress" is expected. The "install" folder contains the script to set up the system (create database tables, init certain parameters, etc). This only needs to be done once. Right now the system only supports SQL Server directly. But the method for adding database support is, I think, quite simple. In short here's the skinny. If you look in the folder cfc_DepressedPress\Security you'll see a "DB_" folder. These are interface-like CFCs containing all of the persistence methods in use by the library. ALL persistence (whether it be database, file access, etc) is abstracted to these files. I call these files "brokers" - they provide a stable interface to the rest of the application no matter what persistence layer is in use. If you look at the "DB_SQLServer2000" you'll see the completed version for SQL server (I assume that most of that code would transfer to other DBs). To create a new DB copy "DB_" (or "DB_SQLServer2000") to a new directory, say "DB_MySQL". Now modify the code to meet that DBs requirements (can't help you much there... but most of the SQL is pretty basic). The big one is the " DP_SecurityConfiguration_Broker.cfc" - this handles all table creation (for install) and table destruction (for uninstall). Brokers (really sets of brokers) are represented in the application by the "DP_PersistenceInfo.cfc" (in the case by a sub class of it called " DP_PersistenceInfo_DSN.cfc"). These are REALLY simple CFCs that contain just the most basic information about a persistence entity. You instantiate one of these and pass it to the application - that tells the application how to find it's persistence information. For example: <cfset PersistenceEntity = CreateObject("Component", "CFC_DepressedPress.Utility.DP_PersistenceInfo_DSN").init( "SQLServer2000", "DSNName", "AppName", "", "") /> This creates a DSN. The "SQLServer2000" tells it to use brokers from the "DB_SQLServer2000" folder. The "DSNName" is the actually system DSN Name and the "AppName" is a prefix that will be pre-pended to all table references. To then install the application to this DB you could do this: <cfset DP_SecurityConfiguration = CreateObject("Component", "CFC_DepressedPress.Security.DP_SecurityConfiguration").init(PersistenceEnti ty) /> <cfset DP_SecurityConfiguration.createDataTables() /> Note that the DP_SecurityConfiguration object (it handles all the install/uninstall tasks) actually accepts a lot of optional parameters to configure the system. In any case you can then instantiate the security system proper in Application.cfm or Application.cfc like so: <!--- Create the Persistence Entity ---> <cfset Application.PersistenceEntity = CreateObject("Component", "CFC_DepressedPress.Utility.DP_PersistenceInfo_DSN").init("SQLServer2000", "DSNName", "AppName", "", "") /> <!--- Set up the security system ---> <cfset Application.DPSecurity = CreateObject("Component", "CFC_DepressedPress.Security.DP_Security").init(Application.PersistenceEntit y) /> I hope this is clear(ish). The idea may seem cumbersome but it does provide quite a bit of freedom. You can generate as many broker sets as you like (and not just for DBs but also for file system, XML, LDAP, etc) without changing the app. Using the same codebase (but passing it differently configured PersistenceEntities) you can run against multiple datasource or databases. In any case I hope I've not scared you away. ;^) Jim Davis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255700 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

