13 Replies Latest reply on May 31, 2017 12:50 PM by tmaurer

    createMember() undefined

    iainbrown

      I've been working on building a version of Ryan Rutan's admin essentials add-on, as detailed here: The specified item was not found.

       

      Until the Fall release, although I was having a few issues with batch execution success rates, the createMember function was working, but now after the upgrade the createMember function appears to be undefined for the group that I'm working in (any group: I've tried multiple groups and Jive instances). I see the same behaviour in sandbox.jiveon.com as I do in an instance where I'm a full admin.

       

      I am retrieving the group using the current context that the app has been loaded in:

       

           var options = { entityDescriptor: 700 + "," + ctx.jive.content.id };
           osapi.jive.corev3.places.get(options).execute( function(response) {
                  if (response.error) {
                      appObj.showError("Error loading DL: " + response.error.message + " (" + response.error.code + ")");
                  } else {
                      appObj.handleLoadContext(response.list[0]);
                  } // end if
              });
      

       

      I'm then using the place object later to add the member request:

       

      appObj.currentCtx.createMember({ person : person.resources.self.ref, state : "member"});
      

       

      It's at this point that I get undefined for the createMember function. I am the group owner.

       

      You can see in the object that I'm logging: other functions are defined, but createMember is not:

       

      Screen Shot 2014-12-09 at 12.08.44.png

       

       

      This code has been working previously as you can see from the comments on Ryan's blog, particularly the one mentioning: ""500"message: "Internal server error: Membership was created but cannot be retrieved","

       

      In the javascript API documentation there is a note that functions will be undefined where you don't have permission to execute them; has something changed in the permission model for adding memberships to groups that would have had an effect?

       

      I have other php code that accesses the REST API using OAuth remotely and that still appears to be working ok:

       

      POST to:

      /members/places/$jivePlaceId
      

      with data:

      $jiveDoc =  '{ "person": "https://cisco-poc.jiveon.com/api/core/v3/people/'.$jiveMemberId.'", "state": "member" }';
      

       

       

      Davin Kluttz: anything you might be able to help me track down on this issue?

      Craig McClanahan: I wonder if you are able to provide any insight into any potential API changes I might be running into?

       

      Thanks!

        • Re: createMember() undefined
          Ryan Rutan

          Coming back up from underwater Iain Brown, I just confirmed with engineering that nothing should have changed between the cloud versions. 

           

          Can you send us the raw JSON response that you get here:

          appObj.handleLoadContext(response.list[0]);


          This will tell us if there is an issue in the JS interpreter or the data itself.  Apologies for the delay on this one. =\

            • Re: Re: createMember() undefined
              iainbrown

              Ryan please see the JSON string returned below:

               

               

              It does seem to suggest that I only have GET access to the members API:

               

               "members": {
                          "allowed": [
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/members/places/9030"
                      },
              

               

              FYI, I get an identical JSON response with REST call to "/places/" endpoint for the same group, yet I am still able to add members direct using a POST request. This would suggest to me that there's a permissions mismatch somewhere in the JSON response vs. what I can actually do.

               

              So, is it the response that is used to determine the permissions for the javascript calls?

               

              Thanks!

               

              This is the same in the instance where I have Full admin (this excerpt is from sandbox.jiveon.com).

               

              {
                  "type": "group",
                  "groupType": "PRIVATE",
                  "tags": [
                      "collaboration",
                      "project",
                      "assignment",
                      "team",
                      "workspace"
                  ],
                  "iconCss": "jive-icon-group",
                  "resources": {
                      "invites": {
                          "allowed": [
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/invites/places/9030"
                      },
                      "contents": {
                          "allowed": [
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/contents"
                      },
                      "pages": {
                          "allowed": [
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/pages"
                      },
                      "self": {
                          "allowed": [
                              "PUT",
                              "DELETE",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030"
                      },
                      "places": {
                          "allowed": [
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/places"
                      },
                      "avatar": {
                          "allowed": [
                              "DELETE",
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/avatar"
                      },
                      "blog": {
                          "allowed": [
                              "PUT",
                              "DELETE",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9031"
                      },
                      "featuredContent": {
                          "allowed": [
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/contents/featured"
                      },
                      "extprops": {
                          "allowed": [
                              "DELETE",
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/extprops"
                      },
                      "followers": {
                          "allowed": [
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/followers"
                      },
                      "announcements": {
                          "allowed": [
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/announcements"
                      },
                      "html": {
                          "allowed": [
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/groups/iains-place"
                      },
                      "categories": {
                          "allowed": [
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/categories"
                      },
                      "followingIn": {
                          "allowed": [
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/followingIn"
                      },
                      "activity": {
                          "allowed": [
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/activities"
                      },
                      "members": {
                          "allowed": [
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/members/places/9030"
                      },
                      "statics": {
                          "allowed": [
                              "POST",
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/statics"
                      },
                      "entitlements": {
                          "allowed": [
                              "GET"
                          ],
                          "ref": "https://sandbox.jiveon.com/api/core/v3/places/9030/entitlements"
                      }
                  },
                  "extendedAuthorsEnabled": false,
                  "status": "Active",
                  "contentTypes": [
                      "blog",
                      "documents",
                      "files",
                      "discussions",
                      "polls",
                      "projects",
                      "updates",
                      "ideas",
                      "events",
                      "videos"
                  ],
                  "memberCount": 1,
                  "creator": {
                      "type": "person",
                      "id": "2446",
                      "resources": {
                          "trendingPlaces": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@trendingPlaces"
                          },
                          "trendingContent": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@trendingContent"
                          },
                          "reports": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@reports"
                          },
                          "securityGroups": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/securityGroups"
                          },
                          "manager": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@manager"
                          },
                          "recognition": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@recognition"
                          },
                          "pages": {
                              "allowed": [
                                  "POST",
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/pages"
                          },
                          "self": {
                              "allowed": [
                                  "PUT",
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446"
                          },
                          "tasks": {
                              "allowed": [
                                  "POST",
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/tasks"
                          },
                          "avatar": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/avatar?a=1025"
                          },
                          "colleagues": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@colleagues"
                          },
                          "extprops": {
                              "allowed": [
                                  "DELETE",
                                  "POST",
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/extprops"
                          },
                          "following": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@following"
                          },
                          "followers": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@followers"
                          },
                          "social": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/@social"
                          },
                          "images": {
                              "allowed": [
                                  "POST",
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/images"
                          },
                          "html": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/people/iaibrown%40cisco.com"
                          },
                          "streams": {
                              "allowed": [
                                  "POST",
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/streams"
                          },
                          "followingIn": {
                              "allowed": [
                                  "POST",
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/followingIn"
                          },
                          "members": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/members/people/2446"
                          },
                          "activity": {
                              "allowed": [
                                  "GET"
                              ],
                              "ref": "https://sandbox.jiveon.com/api/core/v3/people/2446/activities"
                          }
                      },
                      "jive": {
                          "username": "iaibrown@cisco.com",
                          "level": {
                              "name": "Adventurer",
                              "points": 189,
                              "imageURI": "https://sandbox.jiveon.com/api/core/v3/images/status/statusicon-49.gif"
                          },
                          "externalContributor": false
                      },
                      "name": {
                          "formatted": "Iain Brown",
                          "familyName": "Brown",
                          "givenName": "Iain"
                      },
                      "emails": [
                          {
                              "jive_showSummaryLabel": true,
                              "jive_displayOrder": 3,
                              "primary": true,
                              "value": "iaibrown@cisco.com",
                              "type": "work",
                              "jive_summaryDisplayOrder": 2,
                              "jive_label": "Email"
                          }
                      ],
                      "displayName": "Iain Brown"
                  },
                  "id": "1183",
                  "visibleToExternalContributors": false,
                  "updated": "2014-12-02T13:25:10.040+0000",
                  "description": " ",
                  "placeTopics": [],
                  "name": "Iain's place",
                  "placeID": "9030",
                  "followerCount": 1,
                  "published": "2013-10-30T10:29:33.161+0000",
                  "displayName": "iains-place",
                  "viewCount": 150
              }
              
                • Re: createMember() undefined
                  Ryan Rutan

                  Sorry for missing this update last week, i'll pass this along to the team.

                    • Re: createMember() undefined
                      Ryan Rutan

                      So it looks like the API might be trying to be smart. =)  Can you check to see if the user in question is already a member of the group?  If so, then check again with a user not in the group, and see if createMember appears?  This is what the code suggests internally, which just means we need to add some filter logic or skipping for when createMember is not present. 

                       

                      Let me know what you see here =)

                        • Re: createMember() undefined
                          iainbrown

                          Unfortunately, I don't think that's it. It's failing at the point where it tries to add to the osapi batch and I get the same error regardless of if the user is a member of not.

                           

                          I know before that I was getting the expected 'user is already a member' error too.

                           

                          I might try building the admin essentials add-on from your source again, although the last time I did that I got the same errors.

                           

                          I really thought I was there prior to the fall release and just had to get past the throttling issues.

                  • Re: createMember() undefined
                    tmaurer

                    We had what seemed to be a similar issue as this, and may have turned out to be that we had two versions of the add-on installed at the same time, and so it didn't work properly. Not sure if this is useful information for anyone else - ONLY 1 of these can be installed (so can't have in preview mode with two people running parallel tests on the same instance, which is what we were doing).

                    1 person found this helpful