Select to view content in your preferred language

Where does the parameter "portalUser" come from?

3719
20
Jump to solution
03-21-2017 10:43 AM
JoseSanchez
Frequent Contributor

Hello everyone,

I do not understand very well the notation for this function:    function (portalUser){

The parameter "portalUser" where is it populated and declared?

Is there any online converted that changes from AMD to other structure easier to read?

This function is used in this sample: https://developers.arcgis.com/javascript/3/jssamples/portal_oauth_inline.html

Thanks

function displayItems(){
     
new arcgisPortal.Portal(info.portalUrl).signIn().then(
       
function (portalUser){
          console
.log("Signed in to the portal: ", portalUser);

          domAttr
.set("userId", "innerHTML", portalUser.fullName);
          domStyle
.set("anonymousPanel", "display", "none");
          domStyle
.set("personalizedPanel", "display", "block");

          queryPortal
(portalUser);
       
}
     
).otherwise(
       
function (error){
          console
.log("Error occurred while signing in: ", error);
       
}
     
);

0 Kudos
20 Replies
JoseSanchez
Frequent Contributor

The final code:

var portal = new arcgisPortal.Portal('http://[myorganization].maps.arcgis.com');

portal.signIn().then(function (loggedInUser) {

console.log("Signed in to the portal: ", loggedInUser);

console.log(loggedInUser.fullName);

var myArray = null;

 

var myArray = loggedInUser.getGroups;

loggedInUser.getGroups().then(function (groups) {

array.forEach(groups, function (group) {

var title = group.title;

console.log(title);

});

});

 

});

0 Kudos