Expand my Community achievements bar.

Roles get differant views

Avatar

Level 1

Just started playing around with this and ran into a problem

Basically all i am trying to do is, dependant on the role Owner/Viewer the client will show a separate screen. Sounds easy enough, but here is what i have and it does seem to work as expected.

I was under the impression that if i had a login on the Guest or Owner authenticated this event would be launched ( authenticationSuccess="handleSuccess()" ) from AdobeHSAuthenticator.  However, it is actually launching first and i am getting a role of -1.  I know I must have totally missed something obvious. Any help would be greatly appreciated.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:rtc="AfcsNameSpace" creationComplete="showLogin()">
    <rtc:ConnectSessionContainer  id="cSession"  autoLogin="false" width="100%" height="100%" roomURL="https://connectnow.acrobat.com/myAccount/myfirstroom">
        <rtc:authenticator>
            <rtc:AdobeHSAuthenticator id="auth" authenticationSuccess="handleSuccess()" />

        </rtc:authenticator>
    </rtc:ConnectSessionContainer>
 
    <mx:Script>
        <![CDATA[
            import com.adobe.rtc.sharedManagers.descriptors.UserDescriptor;
            import mx.managers.PopUpManager;

            protected function showLogin():void
            {
                var login:LoginDialog = new LoginDialog();
                login.connectSession = cSession;
                PopUpManager.addPopUp(login, this);
                PopUpManager.centerPopUp(login);
            }
           
            private function handleSuccess():void{
                var ud:UserDescriptor = new UserDescriptor();
                trace("MY ROLE "+ud.role)
            }
           
        ]]>
    </mx:Script>
</mx:Application>

2 Replies

Avatar

Former Community Member

Hi,

There are two things that you need to change...

a) Authentication Success is fired when you are just authenticated but your UserManager hasnot syncd yet. So, you need to either listen to creationComplete event in ConnectSessionContainer or Synchronization change event and there you need to call the role.

b) You get your role from UserManager, so you need to call cSession.userManager.myUserRole . Here is your modified code:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:rtc="AfcsNameSpace" creationComplete="showLogin()">

<rtc:ConnectSessionContainer id="cSession" autoLogin="false" width="100%" height="100%" roomURL="https://connectnow.acrobat.com/myAccount/myfirstroom" creationComplete="handleSuccess()">

<rtc:authenticator>

<rtc:AdobeHSAuthenticator id="auth" />

</rtc:authenticator>

</rtc:ConnectSessionContainer>

<mx:Script>

<![CDATA[

import com.adobe.rtc.sharedManagers.descriptors.UserDescriptor;

import mx.managers.PopUpManager;

protected function showLogin():void

{

var login:LoginDialog = new LoginDialog();

login.connectSession = cSession;

PopUpManager.addPopUp(login, this);

PopUpManager.centerPopUp(login);

}

private function handleSuccess():void{

trace("MY ROLE "+ cSession.userManager. myUserRole);

}

]]>

</mx:Script>

</mx:Application>

Hope this helps.

Thanks

Hironmay Basu