2011-09-07 3 views
0

로그인을 허용 할 때 실행되는이 actionscript 코드 블록이 있습니다. 나는 사용자를 위해 일련의 역할을 다시로드하려고한다. 결과 핸들러를 hasRole() 메소드에 추가했습니다.Graniteds - ejb.Tide - Identity.hasRole() 함수 - 잘못된 인수

[Observer("loginAttempted")] 
public function loginAttempted():void { 
    identity.isLoggedIn(isLoggedInResult); 

    trace(identity.loggedIn+" "+identity.username); 
    var perms:Array = Permission.constants; 
    var i:int 
    trace("Load permissions"); 
    for(i=0;i<perms.length;i++) 
    { 
     var p:Permission = perms[i]; 
     var res = identity.hasRole(p.name,permissionResult); 
     if(res == true) 
     { 
      p.allowed = res; 
     } 
     trace(i+" "+p.name +" "+p.allowed+" "+res); 
    } 
} 

private function permissionResult(event:TideResultEvent):void { 
    trace("permissionResult "+event.result); 
} 

이 오류가 계속 발생합니다. graniteds docs을 기반으로 함수는 하나의 인수 만 가져야합니다.

[Fault] exception, information=ArgumentError: Error #1063: 
Argument count mismatch on Main/permissionResult(). Expected 1, got 2. 
at TideRoleResponder/result()[C:\workspace\graniteds\as3\framework\org\granite\tide\ejb\Identity.as:201] 
at org.granite.tide::Tide/result()[C:\workspace\graniteds\as3\framework\org\granite\tide\Tide.as:1831] 
at org.granite.tide.rpc::ComponentResponder/result()[C:\workspace\graniteds\as3\framework\org\granite\tide\rpc\ComponentResponder.as:65] 
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:199] 
at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:172] 
at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:199] 
at org.granite.tide.rpc::TideOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\workspace\graniteds\as3\framework\org\granite\tide\rpc\TideOperation.as:73] 
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:263] 
at mx.rpc::Responder/result()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:46] 
at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74] 
at NetConnectionMessageResponder/resultHandler()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:524] 
at mx.messaging::MessageResponder/result()[C:\autobuild\3.5.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:199] 

답변

3

우리는 비슷한 작업을 수행 할 정체성에 ifAnyGranted 기능을 사용하고 있으며, 우리의 결과 핸들러는 2 인자가 다음 TideResultEvent 및 역할을 포함하는 문자열. permissionResult 함수의 서명을 다음과 같이 변경하십시오.

private function permissionResult(event:TideResultEvent, role:String):void