ColdFusion 9 ORM - Securing an object at a low level...

Posted on Stack Overflow See other posts from Stack Overflow
Published on 2009-09-10T01:01:36Z Indexed on 2010/04/05 11:03 UTC
Read the original article Hit count: 295

Filed under:
|
|

Hiya:

I wonder if anybody has an idea on this...

I'm looking at securing a low level object in my model (a "member" object) so by default only certain information can be accessed from it.

Here's a possible approach (damn sexy if it would work!):

1) Add a property called "locked" - defaulting to "true" to the object itself.

It appears that the only option to do this, and not tie it to a db table column, is to use the formula attribute that takes a query. So to default locked to TRUE I've got:

<cfproperty name="locked" formula="select 1" />

2) Then, I overwrite the existing set-ers and get-ers to use this: e.g.

<cffunction name="getFullname" returnType="string">	
	<cfscript>
		if (this.getLocked()) {
			return this.getScreenName();
		} else {
			return this.getFullname();
		}

	</cfscript>
</cffunction>

3) When i use it like this:

<p> #oMember.getFullName()# </p>

shows the ScreenName (great!)

but... When I do this:

<cfset oMember.setLocked(false)>
<p> #oMember.getFullName()# </p>

Just hangs!!! It appears that attempting to set a property that's been defined using "formula" is a no-no.

Any ideas? Any other way we can have properties attached to an ORM object that are gettable and settable without them being present in the db?

Ideas appreciated!

© Stack Overflow or respective owner

Related posts about coldfusion

Related posts about orm