Skip to main content
Inspiring
April 22, 2013
Question

Unable to use Datasource.cfc in Admin API - The current user is not authorized to invoke this method

  • April 22, 2013
  • 3 replies
  • 2601 views

Hi Everyone,

I am having some issues accessing the methods in the datasource.cfc in the adminAPI.

I can successfully load the administrator CFC and am told that I have successsfuly logged in;

But when I try to subsequently load the datasource.cfc I get an error that the current user is unable to access the method.

/* Create an Admin API object and call the login method */

                                                  var local = {};

                                                  local.adminObj = createObject("component", "cfide.adminapi.administrator");

                                                  /* Enter your password for the CF Admin */

  /* if you dump this - TRUE is returned */

                                                  local.adminObj.login(adminPassword="my_admin_user_password");

                                                  /* Create an object of datasource component */

                                                  local.dsnObj = createObject("component", "cfide.adminapi.datasource");

  writeDump(local.dsnObj.getDataSources());

I tried creating separate admin users and passwords - yhinking that perhaps a revent hotfix had stopped the "admin" user from being allowed to use the adminAPI - but changing to a new adminuser yielded the same results.

I could login to the admin API with the new username and passsword - but could not access the datasource.cfc after that.

Here is the debug output from the error...

The current user is not authorized to invoke this method.

The error occurred in accessmanager.cfc: line 48
Called from datasource.cfc: line 52
Called from C:/inetpub/wwwroot/projectDir/trunk/Application.cfc: line 155
Called from C:/inetpub/wwwroot/projectDir/trunk/Application.cfc: line 52
Called from C:/inetpub/wwwroot/projectDir/trunk/Application.cfc: line 45
Called from C:/inetpub/wwwroot/projectDir/trunk/Application.cfc: line 1
-1 : Unable to display error's location in a CFML template. 

Resources:

Browser  Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
Remote Address  127.0.0.1
Referrer 
Date/Time  22-Apr-13 01:09 PM
Stack Trace
at cfaccessmanager2ecfc974154242$funcCHECKADMINROLES.runFunction(E:/cf10_final/cfusion/wwwroot/CFIDE/adminapi/accessmanager.cfc:48) at cfdatasource2ecfc1679861966$funcGETDATASOURCES.runFunction(E:/cf10_final/cfusion/wwwroot/CFIDE/adminapi/datasource.cfc:52) at cfApplication2ecfc498167235$funcPREREQUISITESTART.runFunction(C:/inetpub/wwwroot/projectDir/trunk/Application.cfc:155) at cfApplication2ecfc498167235$funcINIT.runFunction(C:/inetpub/wwwroot/projectDir/trunk/Application.cfc:52) at cfApplication2ecfc498167235._factor5(C:/inetpub/wwwroot/projectDir/trunk/Application.cfc:45) at cfApplication2ecfc498167235.runPage(C:/inetpub/wwwroot/projectDir/trunk/Application.cfc:1)

coldfusion.runtime.CustomException: The current user is not authorized to invoke this method. at coldfusion.tagext.lang.ThrowTag.doStartTag(ThrowTag.java:142) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799) at cfaccessmanager2ecfc974154242$funcCHECKADMINROLES.runFunction(E:\cf10_final\cfusion\wwwroot\CFIDE\adminapi\accessmanager.cfc:48) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432) at cfdatasource2ecfc1679861966$funcGETDATASOURCES.runFunction(E:\cf10_final\cfusion\wwwroot\CFIDE\adminapi\datasource.cfc:52) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432) at cfApplication2ecfc498167235$funcPREREQUISITESTART.runFunction(C:\inetpub\wwwroot\projectDir\trunk\Application.cfc:155) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2659) at cfApplication2ecfc498167235$funcINIT.runFunction(C:\inetpub\wwwroot\projectDir\trunk\Application.cfc:52) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2659) at cfApplication2ecfc498167235._factor5(C:\inetpub\wwwroot\projectDir\trunk\Application.cfc:45) at cfApplication2ecfc498167235.runPage(C:\inetpub\wwwroot\projectDir\trunk\Application.cfc:1) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244) at coldfusion.runtime.TemplateProxyFactory.resolveComponentHelper(TemplateProxyFactory.java:538) at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:234) at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:159) at coldfusion.runtime.TemplateProxyFactory.resolveFile(TemplateProxyFactory.java:120) at coldfusion.cfc.CFCProxy.<init>(CFCProxy.java:138) at coldfusion.cfc.CFCProxy.<init>(CFCProxy.java:84) at coldfusion.runtime.AppEventInvoker.<init>(AppEventInvoker.java:64) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:232) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:112) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94) at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.CfmServlet.service(CfmServlet.java:219) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414) at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:204) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

And here is the listed exceptions, beneath the stack trace;

13:09:56.056 - cfadminapiSecurityError Exception - in E:/cf10_final/cfusion/wwwroot/CFIDE/adminapi/accessmanager.cfc : line 48

         The current user is not authorized to invoke this method. 

13:09:56.056 - cfadminapiSecurityError Exception - in E:/cf10_final/cfusion/wwwroot/CFIDE/adminapi/accessmanager.cfc : line 48

         The current user is not authorized to invoke this method. 

13:09:56.056 - java.io.FileNotFoundException - in C:/ColdFusion10/cfusion/wwwroot/WEB-INF/exception/errorcontext.cfm : line 44

         E:/cf10_final/cfusion/wwwroot/CFIDE/adminapi/accessmanager.cfc (The system cannot find the path specified)

This perspn seems to be having the same issue;

http://forums.adobe.com/message/5051892

and I agree I don't have "E" drive either!

    This topic has been closed for replies.

    3 replies

    BKBK
    Community Expert
    Community Expert
    July 6, 2013

    An unfamiliar drive letter, such as "E", is usually a give-away: you likely have to install the latest updates and hotfixes. The forum thread you reference actually suggests that.

    Inspiring
    July 7, 2013

    Thanks - but the installation is completely up to date.

    I haven't yet checked the code to see where it is that I am running the code, but Martin's comment sounds promising.

    It is entirely possible that I have changed the method in which the datasource API is being used.

    I'll do a check once i have some time and update the bug, after that.

    Gavin.

    BKBK
    Community Expert
    Community Expert
    July 7, 2013

    Just out of curiosity, is the location of the CFIDE file C:/inetpub/wwwroot/CFIDE?

    Participating Frequently
    July 6, 2013

    I've found a solution to my plight - I don't know if it'll work for you or help you try something that MAY fix it.

    I use a common code set which includes the Application.cfc from a CF Mapping - So, in the application.cfc in the actual website I do this:-

    <cfinclude template="/UberDirectory/Application.cfc">

    Then, in the /UberDirectory/Application.cfc, I was initialising a CFC which checks if the datasource was created for the website. The datasource checking code attempts to log into the Admin API and check & create if necessary the datasource.

    This has previously worked without fail for me - But in this instance it failed!! I was doing two things wrong - Firstly, the CFC should only be called in the Application.cfc in the onRequestStart section as the Application had to be initialised first - This is maybe because I've invoked the application.cfc in a "non-standard" manner.

    Secondly, once I'd moved the CFC invocation into oNRequestStart I saw the following error:-

    The string COOKIE.CFAUTHORIZATION_uber-directory is not a valid ColdFusion variable name.

    I had this as the app name .... <cfset this.name = 'uber-directory'>

    Changedthe dash to an underscore and I was away and could once again check the datasources

    Hope it helps

    Martin

    Inspiring
    April 22, 2013

    I have logged bug :

    354632

    Participating Frequently
    July 6, 2013

    You missed a digit of the bug ID Gavin


    https://bugbase.adobe.com/index.cfm?event=bug&id=3546323