Expand my Community achievements bar.

Problem with FileShare pod

Avatar

Level 2

Hi,

  I am trying to set up the file share pod, but am getting a problem where the 'Upload a file..' but is enabled, but clicking on it does nothing.

  The fileshare pod appears fine in the window (with upload button initially disabled), and when the LCCS connects, the 'Upload a file' button enables correctly, but clicking on it does not bring up any window.  Is there something I am missing?

  Below is my code

<?xml version="1.0" encoding="utf-8"?>
<s:Window xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/halo" width="400" height="300" xmlns:rtc="AfcsNameSpace">
    <fx:Script>
        <![CDATA[
            import com.livesas.model.MonitorModelLocator;
            import mx.events.FlexEvent;

            [Bindable]
            private var  modelLocator:MonitorModelLocator =  MonitorModelLocator.getInstance();

        ]]>
    </fx:Script>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
        <rtc:FileShare   width="100%" height="100%" connectSession="{modelLocator.afcsManager.connectSession}" />

</s:Window>

As you can see, it is in an AIR application, and I tried with FP9 and FP10 version of latest AFCS.swc.

thanks

Mark

16 Replies

Avatar

Level 2

I hooked up the source for the FP9 afcs.swc, and stepped through the afcs code.  It turns out that it is a permissions problem.

I get to the following code in FilePublisher.as when I click on the upload button

public function browse(p_itemID:String, p_typeFilter:Array=null):void
        {
            // Don't open this up if the user doesn't  have upload permissions.
            if(!_model.canIUpload(_groupName)) {
                showAlertMessage(_lm.getString("You do not have sufficient permission to perform the upload operation."));
                return;   
            }

...

the line  if(!_model.canIUpload(_groupName)) {

is returning false.  showAlertMessage(_lm.getString("You do not have sufficient permission to perform the upload operation.")); is not showing an Alert box for me for some reason.

I'm stumped why I don't have permission to upload, I have 'Auto-Promote Users' checked for the room.  What do I need to do to allow guest users to upload?

thanks

Mark

Avatar

Former Community Member

Hi,

I created a fresh AIR project with fileShare pod and player 10 swc and it uploads fine for me. Here is the code, there might be some security setting preventing you. I am not sure how you are using your MonitorModelLocator to get the session. L

Here is my code with Flash Builder 2 beta and player 10 swc for FileShare.

Let me know if you are able to run my code for FileShare. Can you post a simpler complete code if it still doesn't work for you.

Hope this helps.

Thanks

Hironmay Basu

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:rtc="AfcsNameSpace"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/halo" width="400" height="400">

<fx:Declarations>

<!-- Place non-visual elements (e.g., services, value objects) here -->

<rtc:AdobeHSAuthenticator id="auth" userName="XXXXXXXX" password="XXXXXX" />

</fx:Declarations>

<rtc:ConnectSessionContainer id="cSession" authenticator="" width="100%" height="100%" roomURL="XXXXXXXXX" >

<mx:VBox width="100%" height="100%">

<rtc:FileShare width="100%" height="100%" />

</mx:VBox>

</rtc:ConnectSessionContainer>

</s:WindowedApplication

Avatar

Employee

If you are not logging in as the host, and you didn't configure the room correctly (by accessing it as the host) even after the autopromote you don't have the correct privileges.

Try looking at the room with the DevConsole, and I am sure Hironmay can chip in and tell you what to do to "initialize" the room correctly.

Avatar

Former Community Member

Hi,

What is the publishModel value for your File node for this user. You can use FilePublisher's getNodeConfiguration and getUserRole API to compare the values.

For publishing to work, the user's role value should be greater than the publishModel value for that file node.

One quick fix you can do is go to dev console , see what the publishModel of the FileNode you have, by clicking on configure on the FileFolder( folder name is the same as file node name) and change either that value to equal and lower to userRole value.

As an added note,

You can also use setNodeConfiguration and setUserRole API's in FilePublisher to tweak programatically the roles of users and node configurations.

Hope this helps

Thanks

Hironmay Basu

Avatar

Level 2

Hi Hironmay

  Thanks for your quick replies.

  I set the 'publish model' for the FIle folder down to 10, but I am still seeing the same problem.

  I went deeper into the AFCS code (when clicking on the uploadbutton), and I get to the following function in CollectionNode.as

public function canUserPublish(p_userID:String, p_nodeName:String):Boolean
        {
            if (!isNodeDefined(p_nodeName)) {
                return (getUserRole(p_userID, p_nodeName)>=UserRoles.OWNER);
            }

p_nodeName is _FileShare_FileShare1

There is no node named '_FileShare_FileShare1' (however there is one named 'default_FileSharePod') , and the user is not an owner, so I get returned.

  I can successfully run your code, and can even use a FileShare pod as a guest when I wrap the FileShare pod in a ConnectSessionContainer, so this must have something to do with me using the connectSession attribute within the <rtc:FileShare tag.  (I have to do this, as I am creating the room dynamically from a template before logging on).

  I'll try to create some simpler code using ConnectSession property (rather than using ConnectSessionContainer) to try to recreate the problem.

thanks

Mark

Avatar

Former Community Member

Hi,

From where does FileShareFileShare1 comes , are you setting the sharedID of the FilePublisher somewhere ? By default, it is 'default_FileSharePod' .

The sharedID becomes the groupID and nodeName in turn.

Thanks

Hironmay Basu

Avatar

Level 2

That's the thing, I do not know where the name  _FileShare_FileShare1 is coming from.  I can see (from the Room Console) that the room contains the  folder named default_FileSharePod.

Anyway, I got it to work by doing the below:

<rtc:FileShare  sharedID="default_FileSharePod"   width="100%" height="100%" connectSession="{modelLocator.afcsManager.connectSession}" />

Now I can click the upload button, and p_nodeName is 'default_FileSharePod'.  The code is happy and lets me select a file. 

  However, I am still puzzled why it was looking for a node named _FileShare_FileShare1.  I have searched the AFCS code and my own, and can't find any reference to that name.

Avatar

Level 2

Actually I spoke too soon.  Now I can select a file to Upload, but after selecting a file to upload, the file never appears in the list.

Avatar

Former Community Member

I am also puzzled with FileShareFileShare1. Can you do something? Try logging in as an User in the room and call cSession.fileManager.removeGroup('_FileShare_FileShare1') and then see what happens. If you are able to delete correctly, after that the default should work ( hopefully ).

Can you also try creating a new room and see if this problem repeats for you ?

Thanks

Hironmay Basu

Avatar

Level 2

Here is some simple code that demonstrates my problem (you can add  sharedID="default_FileSharePod" to rtc:FileShare tag to see my 2nd problem about the uploaded file not showing):

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication initialize="windowedapplication1_initializeHandler(event)" xmlns:mx="http://www.adobe.com/2006/mxml" backgroundAlpha="0" showFlexChrome="false"  layout="absolute" width="100%" height="100%" xmlns:rtc="AfcsNameSpace">
    <mx:Script>
        <![CDATA[
            import com.adobe.rtc.authentication.AdobeHSAuthenticator;
            import com.adobe.rtc.events.SessionEvent;
            import com.adobe.rtc.session.ConnectSession;
           
            import mx.events.FlexEvent

            protected function windowedapplication1_initializeHandler(event:FlexEvent):void
            {
                connectToRoom("firstRoom");
            }
           
            private var authenticator:AdobeHSAuthenticator = new AdobeHSAuthenticator();
           
            [Bindable]
            public var connectSession:ConnectSession = new ConnectSession();
           
            public function connectToRoom(roomName:String):void
            {
                    authenticator.userName = "guest";
               
               
                connectSession.authenticator = authenticator;
               
                connectSession.roomURL = [YOUR ROOM URL HERE];
                connectSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onConnectionChange);
                connectSession.login();
               
            }
           
            private function onConnectionChange(event:SessionEvent):void
            {
                this.connectSession = event.currentTarget as ConnectSession;
            }

        ]]>
    </mx:Script>
        <rtc:FileShare width="100%" height="100%" connectSession="{this.connectSession}"  />
</mx:WindowedApplication>

Avatar

Level 2

I tried both cSession.fileManager.removeGroup('_FileShare_FileShare1') and creating a brand new room, but I get the same results.

Avatar

Former Community Member

Hi,

For me , when I do sharedID="default_FileSharePod" I can upload the file and the uploaded file gets added to the list of files under default_FileSharePod group( I can see in dev console).

So, I am unable to reproduce the problem you mentioned and I can't produce the node FileShareFileShare1 . The most surprising part is you can't see that node FileShareFileShare1 in your devconsole. Can you debug in your FileShare source code to see where does this FileShareFileShare1 gets set to the _groupid variable?

Thanks

Hironmay Basu

Avatar

Level 2

Hi Hironmay

  I now know where _FileShare_FileShare1 is coming from.  It is the default id given to the FileShare UI component by Flex (as I am not explicitly specifying an ID).  My parent component (my AIR Window which contains the FileShare component) is named FileShare.  Flex automatically assigns the FileShare component an id of _[parentname]_[ComponentName]x .  If I had named the window component 'MyWin'  _MyWin_FileShare1 would be passed in.

  This default ID is then passed into the AFCS code.  Take a look at FileShare.as line 360


        public function subscribe():void
        {
            // if the id is not set , then take default shared ID if it is not set not, else take the set shared id value
            // if id is set, then if shared id is not set, take set sharedID to id and take it, otherwise , take the set shared id

               if ( id == null ){
                if ( sharedID == null ) {
                    sharedID = DEFAULT_SHARED_ID ;
                }
                _groupid = sharedID;
            }else {
                if ( sharedID != null ) {
                    _groupid = sharedID;
                }else {
                    sharedID = id ;
                    _groupid = sharedID ;
                }
            }

Here, id is _FileShare_FileShare1, so it is not null, so it falls into the final else clause - sharedID and _groupID become _FileShare_FileShare1.

If I add the sharedID property, then I can upload a file, and I do see the newly uploaded file in the Room Console, but I do not see it in the FileShare box.

thanks

Mark

Avatar

Level 2

Hi Hironmay

  Do you have any feedback regarding this?  I would really love to use the FileShare component, but I cannot get it to work when logged into the room as a Guest.

  The AFCS code above (Subscribe function) in FileShare.as seems incorrect to me.  I don't think the component id should be used by AFCS - I think it should only be used by Flex.  It should require the sharedID to be set.  I beleive that the line '  if ( id == null ){' is incorrect because id can never be null.

  When I add the sharedID e.g.

    <rtc:FileShare  sharedID="default_FileSharePod" width="100%" height="100%" connectSession="{this.connectSession}"    />

  and enter the room as a guest (with no host logged in to the room) I am allowed to upload files, and those files do appear in the Room Console, but do not appear in the FileShare component, and addiditionally all the buttons are disabled.  The AFCS code gets to the following function in FileShare.as:

protected function enableButtons():void
        {
            var bSelected:Boolean = (_fileGrid.selectedItems.length > 0 && !isSelectItemsUploadingFile()) ;   
           
            if(_roomManager.roomState == RoomSettings.ROOM_STATE_ACTIVE) {

                    ... code to enable the buttons

                }

          else {
                _downloadButton.enabled = false;                   
                _uploadButton.enabled = false;                   
                _deleteButton.enabled = false;
                _cancelUploadButton.visible = _cancelUploadButton.enabled = false;
            }

  but _roomManager.roomState is 'hostNotArrived' so all the buttons are disabled.

  Please help!!

thanks

Mark

Avatar

Former Community Member

Hi Mark,

Yes I agree with you that there seems to be a bug and I will take a note of it for your future releases. However, you are not supposed to upload as a guest unless the room state is active, that's why you don't see any of the buttons as active. The thing we need to fix on our side is not to let you upload until the state is active and you have the required permission to do so.

You can fix the part locally with sub-classing the FlieShare and making the changes you want.

What's the permission level your guest is having?

Thanks

Hironmay Basu

Avatar

Level 2

Hi Hironmay

  From the debug output, I can see that my guest has permission role PUBLISHER - 50

RECEIVED LOGIN AT SESSION
  .user descriptor from server [object]
    \\
    .displayName [string]= guest
    .role [number]= 50
    .userID [string]= GUEST-A6E3985A-92A0-4518-832D-9775CDD13673
    .affiliation [number]= 5

  I am not sure why the room is not Active.  If only guests are in the room, does this mean that the room is not Active?

  I'll try extending the code and see if I can work around the issue that way.  Thanks for the advice.

thanks

Mark