2016-09-26 2 views
0

Administrator APIを使用してColdFusion 10で管理者ユーザーを作成しようとしています。ColdFusion Administrator APIの使用方法Security.SetUser()メソッド

<cfscript> 
// Create an object of administrator component and call the login method 
adminObj = createObject("component","cfide.adminapi.administrator"); 
adminObj.login("Password1"); 
myObj = createObject("component","cfide.adminapi.security"); 

myObj.setUser(username="ramesh" 
       , password="Password1" 
       , allowadminaccess="True" 
       , Roles="Server Settings > Scheduled Tasks" 
      ); 
</cfscript> 

しかし、それはエラーがスローされます::以下は私のコードがある

The ROLES argument passed to the setUser function is not of type array.

にはどうすれば配列としての役割を渡すのですか?

答えて

0

あなたはそれを思っているかもしれません;-)文字列を通常のように角括弧で囲んで配列に入れてください。

myObj.setUser(Roles = [ Roles="Server Settings > Scheduled Tasks" ] 
       , ... 
      ); 

のドキュメントを参照してください:Creating and using arrays implicitly

関連する問題