Create a base class then create multiple derived classes with the different
access levels you're looking for.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Suyer, Ed
Sent: Thursday, March 04, 2004 11:19 AM
To: '[EMAIL PROTECTED]'
Subject: [CFCDev] Dynamically set function access inside a CFC


Hi folks,

Does anyone know of a way to set the access level of a cfc function when the
object is created?

Here's what I tried (this does not work):

foo.cfc ->
<cfcomponent displayname="foo">
        <cffunction name="init" access="public" returntype="foo"
output="false">
                <!---cfset this.bar.access = "private" /---> <!--- this
doesn't work either --->
                <cfset temp = StructUpdate(this.bar, "access", "private")>
                <cfreturn this />
        </cffunction>
        
        <cffunction name="bar" access="public" returntype="string"
output="false">
                <cfreturn "hello world!" />
        </cffunction>
</cfcomponent>

main.cfm ->
<cfset foo = createObject("component","foo").init() />
<cfdump var="#foo#">


What I'm after is to filter the properties that are available when the
object is constructed (by making the setter/getter methods private for the
properties that are not available).  Ultimately I'd like to marry a filter
object with foo and return a component which makes available the properties
(via the setters/getters) defined by the filter.

Any thoughts?

Ed.     
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to