Title: RE: getRequestService().getContext() problem
Thread: getRequestService().getContext() problem
Forum: Need Help?
Conference: ColdBox
User: sanaullah73
Hi xionic
I just tried your code, with cache=true. It works jut fine I think as
luis mentioned variables should be var scoped that could be a problem without
using var scope.
Here is the code of plugin, I modified a bit to make it work.
[code]
<cfcomponent name="rights" hint="This is the RM
plugin." extends="coldbox.system.plugin"
output="false" cache="true">
<cffunction
name="init" access="public" returntype="rights"
hint="Constructor" output="false">
<cfargument name="controller" type="any"
required="true">
<cfset
super.Init(arguments.controller) />
<cfset
setpluginName("rights")>
<cfset
setpluginVersion("0.1")>
<cfset
setpluginDescription("This plugin is used for checking RM.")>
<cfreturn this />
</cffunction>
<cffunction
name="eventRightsCheck" access="Public"
hint="eventRightsCheck" output="false"
returntype="boolean">
<cfargument
name="message" hint="Event, if not set use this event"
type="string" required="No" >
<cfargument name="user_id" hint="UserID, if not set will try
to get from session, otherwise return false" type="numeric"
required="No" >
<cfset var Context =
controller.getRequestService().getContext()>
<cfset var returnValue =
RandRange(0,1) />
<cfreturn returnValue/>
</cffunction>
</cfcomponent>
[/code]
Please let me know if there's any problem.
Thanks
Sana