问题
<cfscript>
if (isDefined("url.clearTrustedCache")) {
clearTrustedCache();
}
function clearTrustedCache() {
adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login("admin");
runtimeObj = createObject("component","cfide.adminapi.runtime");
runtimeObj.clearTrustedCache();
}
</cfscript>
I am trying to use the above code to clear the trusted cache via URL param. I am getting the following error message:
The current user is not authorized to invoke this method
The only thing I found online to try was http://helpx.adobe.com/coldfusion/kb/error-current-user-authorized-invoke.html but it didn't work (unless I am doing it incorrectly).
Any thoughts or ideas on how to fix this?
回答1:
The solution was to use a password with the login because it was set up to be required in the Coldfusion Admin. If it's not required in the Coldfusion admin (which I don't recommend then a password may not be necessary.
Example:
adminObj.login("passwordHere","loginHere");
来源:https://stackoverflow.com/questions/14325770/coldfusion-access-manager-error-when-attempting-to-clear-trusted-cache