a programmatic way to get Portal groups and Portal members info within WAB

1754
4
Jump to solution
08-18-2016 02:21 PM
Alexwang
Occasional Contributor II

Hi All,

Is there a programmatic way to get Portal groups and Portal members info within WAB?

Thanks in advance!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Alex,

   If you look at widgets that allow you to add data from AGOL there is the Query widget. The query widget allows several different sources of data to be added but for portal it comes down to the jimu/dijits/ItemSelector.js as the main file for selecting portal items. You may want to begin looking there. I personally can not guide you further as I have not had the need to develop a widget that access portal groups or users. Or you could just start developing code that uses portal classes like:

PortalGroup | API Reference | ArcGIS API for JavaScript 3.17 

PortalUser | API Reference | ArcGIS API for JavaScript 3.17 

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Alex,

   If you look at widgets that allow you to add data from AGOL there is the Query widget. The query widget allows several different sources of data to be added but for portal it comes down to the jimu/dijits/ItemSelector.js as the main file for selecting portal items. You may want to begin looking there. I personally can not guide you further as I have not had the need to develop a widget that access portal groups or users. Or you could just start developing code that uses portal classes like:

PortalGroup | API Reference | ArcGIS API for JavaScript 3.17 

PortalUser | API Reference | ArcGIS API for JavaScript 3.17 

Alexwang
Occasional Contributor II

Thanks Robert for the wonderful info. These Portal modules will meet my needs. 

0 Kudos
arunepuri1
New Contributor III

Hi Alex,

Can you please share the code which you used to fetch all portal users and groups.

Gone through the Robert provided links but there are no samples.

Thanks,

Arun E

0 Kudos
AshrafDar
New Contributor

Hi Arun,

You can get the portal groups based on the logged in user permissions from Portal Object as shown in the below given code snippet:

define([
'dojo/_base/declare',
'jimu/portalUtils',

...
],
  function(declare, portalUtils, ...) {

  var aPortal = portalUtils.getPortal(this.appConfig.portalUrl);

  var gArray = aPortal.featuredGroups;

});

The group resource represents a group within the Portal. A group resource represents a group (e.g., "San Bernardino Fires"). The visibility of the group to other users is determined by the access property. If the group is private no one except the administrators and the members of the group will be able to see it. If the group is shared with an organization, then all members of the organization will be able to find the group. View the ArcGIS Portal API REST documentation for the Group for more details. (This is from the API documentation PortalGroup | API Reference | ArcGIS API for JavaScript 3.26 )

Hope this helps you.

Regards,

Mohammad Ashraf Dar

Gistec

0 Kudos