Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Unable to setUserDisplayName for ConnectSessionContainer

Avatar

Level 2
Hello,



Whenever I call
"cSession.userManager.setUserDisplayName(cSession.userManager.myUserID,
name)" I get the below error message (insufficient permission). I'm
not sure why since I logged into the ConnectNow account as the
owner (supplied username and password with AdobeHSAuthenticator).
In addition, cSession.userManager.myUserRole is 100, which is
owner, so I should have sufficient permissions to change the
display name. cSession is a ConnectSessionContainer variable.



It may be worthy to note that I attempt to change the display
name after logging the user out from one ConnectSessionContainer
and then into another ConnectSessionContainer (see below code).



cSession.logout();

cSession.roomURL = room;

cSession.authenticator = auth;

cSession.login();


cSession.userManager.setUserDisplayName(cSession.userManager.myUserID,
name) //throws error message





-------------------------------------- ERROR MESSAGE
-----------------------------------------

Error: UserManager.setUserStatus: insufficient permissions to
change user name

at
com.adobe.rtc.sharedManagers::UserManager/setUserDisplayName()[C:\work\main\connect\cocomo\src\com\adobe\rtc\sharedManagers\UserManager.as:484]





code_away



1 Accepted Solution

Avatar

Correct answer by
Former Community Member
Hi,



I ran a small example for your case. You need to wait for
the synschronization

change event after you relogin since you need to wait for all
Managers

(including UserManager to be synchronized) before you set the
name again.



Here is a small example :



<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute"

xmlns:rtc="AfcsNameSpace" >

<mx:Script>

<![CDATA[

import com.adobe.rtc.events.SessionEvent;

import com.adobe.rtc.sharedManagers.UserManager;



private var _userManager:UserManager ;





private function onLogoutLogin():void

{

cSession.logout();

cSession.roomURL = "Your Room Url";

cSession.authenticator = auth;




cSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE,onEventNotific

ation);

cSession.login();

//throws error message

}





private function
onEventNotification(event:SessionEvent):void

{


cSession.userManager.setUserDisplayName(cSession.userManager.myUserID,


"basu");

}



]]>

</mx:Script>

<rtc:ConnectSessionContainer id="cSession" roomURL="Room
Url">

<rtc:authenticator>

<rtc:AdobeHSAuthenticator userName="User Name"
password="Password"

id="auth" />

</rtc:authenticator>

<rtc:Roster />

<mx:Button label="Logout/Login" click="onLogoutLogin()"
/>

</rtc:ConnectSessionContainer>

</mx:Application>





View solution in original post

3 Replies

Avatar

Former Community Member
Hi,



I ran a small example for your case. You need to wait for the
synschronization change event after you relogin since you need to
wait for all Managers (including UserManager to be synchronized)
before you set the name again.



Here is a small example :



<?xml version="1.0" encoding="utf-8"?>

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

<mx:Script>

<![CDATA[

import com.adobe.rtc.events.SessionEvent;

import com.adobe.rtc.sharedManagers.UserManager;



private var _userManager:UserManager ;





private function onLogoutLogin():void

{

cSession.logout();

cSession.roomURL = "Your Room Url";

cSession.authenticator = auth;


cSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE,onEventNotification);

cSession.login();

//throws error message

}





private function
onEventNotification(event:SessionEvent):void

{


cSession.userManager.setUserDisplayName(cSession.userManager.myUserID,
"Hironmay");

}



]]>

</mx:Script>

<rtc:ConnectSessionContainer id="cSession" roomURL="Room
Url">

<rtc:authenticator>

<rtc:AdobeHSAuthenticator userName="User Name"
password="Password" id="auth" />

</rtc:authenticator>

<rtc:Roster />

<mx:Button label="Logout/Login" click="onLogoutLogin()"
/>

</rtc:ConnectSessionContainer>

</mx:Application>

Avatar

Correct answer by
Former Community Member
Hi,



I ran a small example for your case. You need to wait for
the synschronization

change event after you relogin since you need to wait for all
Managers

(including UserManager to be synchronized) before you set the
name again.



Here is a small example :



<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute"

xmlns:rtc="AfcsNameSpace" >

<mx:Script>

<![CDATA[

import com.adobe.rtc.events.SessionEvent;

import com.adobe.rtc.sharedManagers.UserManager;



private var _userManager:UserManager ;





private function onLogoutLogin():void

{

cSession.logout();

cSession.roomURL = "Your Room Url";

cSession.authenticator = auth;




cSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE,onEventNotific

ation);

cSession.login();

//throws error message

}





private function
onEventNotification(event:SessionEvent):void

{


cSession.userManager.setUserDisplayName(cSession.userManager.myUserID,


"basu");

}



]]>

</mx:Script>

<rtc:ConnectSessionContainer id="cSession" roomURL="Room
Url">

<rtc:authenticator>

<rtc:AdobeHSAuthenticator userName="User Name"
password="Password"

id="auth" />

</rtc:authenticator>

<rtc:Roster />

<mx:Button label="Logout/Login" click="onLogoutLogin()"
/>

</rtc:ConnectSessionContainer>

</mx:Application>





Avatar

Level 2
Ah! That worked... thanks for the solution Hironmay!
The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----