PortalUser Class

  • PortalUser
  • class Esri::ArcGISRuntime::PortalUser

    A registered user of a portal or organization. More...

    Header: #include <PortalUser.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object, Esri::ArcGISRuntime::Loadable, and Esri::ArcGISRuntime::JsonSerializable

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

    PortalUser(Esri::ArcGISRuntime::Portal *portal, const QString &username, QObject *parent = nullptr)
    virtual ~PortalUser() override
    Esri::ArcGISRuntime::PortalAccess access() const
    void addPortalItemWithJson(Esri::ArcGISRuntime::PortalItem *portalItem, const QString &json, const Esri::ArcGISRuntime::PortalFolder &toFolder = PortalFolder())
    void addPortalItemWithUrl(Esri::ArcGISRuntime::PortalItem *portalItem, const QUrl &fromUrl, const QString &fileName = QString(), const Esri::ArcGISRuntime::PortalFolder &toFolder = PortalFolder())
    void addToFavorites(Esri::ArcGISRuntime::PortalItem *portalItem)
    void createFolder(const QString &title)
    QDateTime created() const
    void deleteFolder(const Esri::ArcGISRuntime::PortalFolder &folder)
    void deletePortalItem(Esri::ArcGISRuntime::PortalItem *portalItem)
    QString email() const
    QString favoritesGroupId() const
    void fetchContent()
    void fetchContentInFolder(const QString &folderId)
    void fetchFavoritesStatus(Esri::ArcGISRuntime::PortalItem *portalItem)
    Esri::ArcGISRuntime::PortalFolderListModel *folders() const
    QString fullName() const
    Esri::ArcGISRuntime::PortalGroupListModel *groups() const
    Esri::ArcGISRuntime::PortalItemListModel *items() const
    QDateTime modified() const
    void movePortalItem(Esri::ArcGISRuntime::PortalItem *portalItem, const Esri::ArcGISRuntime::PortalFolder &toFolder = PortalFolder())
    void movePortalItems(const QList<Esri::ArcGISRuntime::PortalItem *> &portalItems, const Esri::ArcGISRuntime::PortalFolder &toFolder = PortalFolder())
    QString organizationId() const
    QString phone() const
    Esri::ArcGISRuntime::Portal *portal() const
    Esri::ArcGISRuntime::PortalPrivilegeListModel *privileges() const
    void removeFromFavorites(Esri::ArcGISRuntime::PortalItem *portalItem)
    Esri::ArcGISRuntime::PortalUserRole role() const
    QStringList tags() const
    QUrl thumbnailUrl() const
    Esri::ArcGISRuntime::UnitSystem units() const
    QString userDescription() const
    QString username() const

    Reimplemented Public Functions

    virtual void cancelLoad() override
    virtual void load() override
    virtual Esri::ArcGISRuntime::Error loadError() const override
    virtual Esri::ArcGISRuntime::LoadStatus loadStatus() const override
    virtual void retryLoad() override
    virtual QString toJson() const override
    virtual QJsonObject unknownJson() const override
    virtual QJsonObject unsupportedJson() const override

    Signals

    void addPortalItemCompleted(bool success)
    void addToFavoritesCompleted(bool success)
    void createFolderCompleted(bool success, Esri::ArcGISRuntime::PortalFolder folder)
    void deleteFolderCompleted(bool success)
    void deletePortalItemCompleted(bool success)
    void doneLoading(Esri::ArcGISRuntime::Error loadError)
    void fetchContentCompleted(bool success)
    void fetchFavoritesStatusCompleted(bool status)
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)
    void movePortalItemCompleted(bool success)
    void movePortalItemsCompleted(QList<Esri::ArcGISRuntime::PortalResult> results)
    void removeFromFavoritesCompleted(bool success)
    void thumbnailUrlChanged()

    Static Public Members

    Esri::ArcGISRuntime::PortalUser *fromJson(const QString &json, Esri::ArcGISRuntime::Portal *portal = nullptr, QObject *parent = nullptr)

    Detailed Description

    A Portal may have users who are unaffiliated with an organization or users who are part of an organization. Users sign in to the portal and create and share content which is organized into items (PortalItem). Users can create and join groups (PortalGroup) and share items with groups. This makes the items visible and accessible to other members of the group. Users could be in different roles including administrators, publishers and information workers. Administrators can add users to their organizations and have access to all content within the organization. All users can create web maps based on mashing up services that they have access to and can register services running on external servers. Publishers within an organization can in addition create hosted services based on data files that they upload.

    Member Function Documentation

    PortalUser::PortalUser(Esri::ArcGISRuntime::Portal *portal, const QString &username, QObject *parent = nullptr)

    Constructs a user for the given portal.

    portal: The Portal for the user to access. username: The registered name of the user. parent (optional).

    [signal] void PortalUser::addPortalItemCompleted(bool success)

    Signal emitted when an add operation is completed. success is true when the operation succeeded.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [signal] void PortalUser::addToFavoritesCompleted(bool success)

    Signal emitted when a addToFavorites operation is completed.

    The parameter success is true when the operation succeeded, otherwise false.

    [signal] void PortalUser::createFolderCompleted(bool success, Esri::ArcGISRuntime::PortalFolder folder)

    Signal emitted when a createFolder operation is completed.

    • success - Whether fetching content completed successfully.
    • folder - The newly created PortalFolder.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [signal] void PortalUser::deleteFolderCompleted(bool success)

    Signal emitted when a deleteFolder operation is completed. success is true when the operation succeeded.

    [signal] void PortalUser::deletePortalItemCompleted(bool success)

    Signal emitted when a delete item operation is completed. success is true when the operation succeeded.

    [signal] void PortalUser::doneLoading(Esri::ArcGISRuntime::Error loadError)

    Signal emitted when this object is done loading.

    • loadError - Details about any error that may have occurred.

    See also Loadable and Object.

    [signal] void PortalUser::fetchContentCompleted(bool success)

    Signal emitted when the fetchContent or fetchContentInFolder operations are completed.

    • success - Whether fetching content completed successfully.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [signal] void PortalUser::fetchFavoritesStatusCompleted(bool status)

    Signal emitted when a removeFromFavorites operation is completed. status is true when the operation succeeded.

    [signal] void PortalUser::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Signal emitted when the loadStatus changes for this object.

    See also Loadable.

    [signal] void PortalUser::movePortalItemCompleted(bool success)

    Signal emitted when a move item operation is completed. success is true when the operation succeeded.

    [signal] void PortalUser::movePortalItemsCompleted(QList<Esri::ArcGISRuntime::PortalResult> results)

    Signal emitted when a movePortalItems operation is completed. The list of results indicates the status for individual items.

    [signal] void PortalUser::removeFromFavoritesCompleted(bool success)

    Signal emitted when a removeFromFavorites operation is completed.

    The parameter success is true when the operation succeeded, otherwise false.

    [signal] void PortalUser::thumbnailUrlChanged()

    Emitted when thumbnailUrl property is changed.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    [override virtual] PortalUser::~PortalUser()

    Destructor.

    Esri::ArcGISRuntime::PortalAccess PortalUser::access() const

    Returns the visibility of a user's information.

    If set to PortalAccess.Private, the user's descriptive information will not be available to others nor will the username be searchable. The organization's administrator can always see all users.

    void PortalUser::addPortalItemWithJson(Esri::ArcGISRuntime::PortalItem *portalItem, const QString &json, const Esri::ArcGISRuntime::PortalFolder &toFolder = PortalFolder())

    Adds a PortalItem from a JSON object.

    The portalItem will be created using the following arguments:

    • portalItem. The local PortalItem which will be added to the portal.
    • json. The JSON representation of the portal item. This format is particularly suitable for adding items such as web maps and is the format used by the Map::saveAs method.
    • toFolder (optional). The folder in which the item will be located. If empty, the item will be placed in the user's root folder.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also Items and item types.

    void PortalUser::addPortalItemWithUrl(Esri::ArcGISRuntime::PortalItem *portalItem, const QUrl &fromUrl, const QString &fileName = QString(), const Esri::ArcGISRuntime::PortalFolder &toFolder = PortalFolder())

    Adds a PortalItem from a local or online URL.

    The PortalItem will be created using the following arguments:

    • portalItem. The local PortalItem which will be added to the portal.
    • fromUrl. The local or online URL from which the portalItem will be populated. For local files, this should be of the form "qrc:/example.csv" or "file://"; for online resources this should be of the form "https://...".
    • fileName (optional). The name of the file which will be associated with the PortalItem (including extension). If a file name is not supplied, the portal item will have no file associated with it for future downloads.

      Note: A file name is only relevant for certain item types such as PortalItemType.Image.

    • toFolder (optional). The folder in whih the item will be located. If empty, the item will be placed in the user's root folder.

    Example:

    Add an item with a local URL:

    QUrl localCSV("qrc:/Samples/CloudAndPortal/AddItemsToPortal/add_item_sample.csv");
    m_user->addPortalItemWithUrl(m_item, localCSV, "add_item_sample.csv" );

    Load the item once it has been successfully loaded

    connect(m_user, &PortalUser::addPortalItemCompleted, this, [this](bool success)
    {
      m_busy = false;
    
      if (!success)
        return;
    
      setStatusText("Successfully added item.");
      m_item->load();
    });

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also Items and item types.

    void PortalUser::addToFavorites(Esri::ArcGISRuntime::PortalItem *portalItem)

    Adds the PortalItem portalItem to the user's favorites group.

    [override virtual] void PortalUser::cancelLoad()

    Reimplements: Loadable::cancelLoad().

    See Loadable.

    void PortalUser::createFolder(const QString &title)

    Creates a new PortalFolder with the given title in the user's root folder.

    Multilevel folders are not supported in a portal.

    QDateTime PortalUser::created() const

    Returns the date and time the user was created.

    void PortalUser::deleteFolder(const Esri::ArcGISRuntime::PortalFolder &folder)

    Removes the specified folder from the portal.

    void PortalUser::deletePortalItem(Esri::ArcGISRuntime::PortalItem *portalItem)

    Removes the PortalItem portalItem from the portal.

    QString PortalUser::email() const

    Returns the user's email address.

    QString PortalUser::favoritesGroupId() const

    The ID of the group that contains the user's favorites.

    void PortalUser::fetchContent()

    Starts an operation that fetches the user's content at the root level (not in a folder).

    The content is made up of lists of PortalItem and PortalFolder objects.

    Example:

    Retrieve the model representing a user's folders:

    // fetch the portal user's folders
    QMap<QString, QString> folderTitles; // folderId and folderTitle
    
    connect(&portalUser, &PortalUser::fetchContentCompleted, this, [&portalUser, &folderTitles](bool success)
    {
      if(!success)
        return;
    
      PortalFolderListModel* folders = portalUser.folders();
      Q_CHECK_PTR(folders);
    
      for (int i = 0; i < folders->size(); ++i)
      {
        PortalFolder folder = folders->at(i);
        folderTitles[folder.folderId()] = folder.title();
        qDebug() << folder.title();
      }
    });
    
    portalUser.fetchContent();

    void PortalUser::fetchContentInFolder(const QString &folderId)

    Starts an operation that fetches the user's content within a specific folder (folderId).

    The content is made up of lists of PortalItem objects.

    void PortalUser::fetchFavoritesStatus(Esri::ArcGISRuntime::PortalItem *portalItem)

    Starts an operation to determine whether PortalItem portalItem is in the user's favorites group.

    The fetchFavoritesStatusCompleted is emitted when the operation is complete.

    Esri::ArcGISRuntime::PortalFolderListModel *PortalUser::folders() const

    Returns a list of PortalFolder objects for the user's content.

    The folders are retrieved by calling fetchContent and the signal fetchContentCompleted is emitted when complete.

    [static] Esri::ArcGISRuntime::PortalUser *PortalUser::fromJson(const QString &json, Esri::ArcGISRuntime::Portal *portal = nullptr, QObject *parent = nullptr)

    Creates a new PortalUser from JSON with an optional Portal and parent.

    The PortalUser will be created using the following arguments:

    • json. The JSON representation of the portal user.
    • portal (optional). A Portal object for use by the PortalUser.
    • parent (optional). A QObject object used as parent.

    To fetch data from an online portal, the JSON must contains the "username" parameter, and portal must be valid.

    const QString json = QStringLiteral(" { \"username\": \"my_username\" }");
    PortalUser* portalUser = PortalUser::fromJson(json, portal, parent);

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also JsonSerializable.

    QString PortalUser::fullName() const

    Returns the user's full name.

    Esri::ArcGISRuntime::PortalGroupListModel *PortalUser::groups() const

    Returns the list of groups for the portal user.

    See also PortalGroup.

    Esri::ArcGISRuntime::PortalItemListModel *PortalUser::items() const

    Returns a list of PortalItem objects for which the user has access.

    The items are retrieved by calling fetchContent or fetchContentInFolder and the signal fetchContentCompleted is emitted when complete.

    [override virtual] void PortalUser::load()

    Reimplements: Loadable::load().

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::Error PortalUser::loadError() const

    Reimplements: Loadable::loadError() const.

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::LoadStatus PortalUser::loadStatus() const

    Reimplements: Loadable::loadStatus() const.

    See Loadable.

    QDateTime PortalUser::modified() const

    Returns the date and time the user was last modified.

    void PortalUser::movePortalItem(Esri::ArcGISRuntime::PortalItem *portalItem, const Esri::ArcGISRuntime::PortalFolder &toFolder = PortalFolder())

    Moves a PortalItem.

    Move item portalItem to the folder specified by toFolder. Leaving toFolder empty will move the item to the user's root folder.

    void PortalUser::movePortalItems(const QList<Esri::ArcGISRuntime::PortalItem *> &portalItems, const Esri::ArcGISRuntime::PortalFolder &toFolder = PortalFolder())

    Moves multiple PortalItems.

    Move the items listed in portalItems to the folder specified by toFolder. Leaving toFolder empty will move the items to the user's root folder.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    QString PortalUser::organizationId() const

    Returns the ID of the organization the user belongs to (if any).

    QString PortalUser::phone() const

    Returns the user's phone number.

    Esri::ArcGISRuntime::Portal *PortalUser::portal() const

    Returns the portal that the user belongs to.

    Esri::ArcGISRuntime::PortalPrivilegeListModel *PortalUser::privileges() const

    A list of the privileges possessed by this user.

    See also PortalPrivilege.

    void PortalUser::removeFromFavorites(Esri::ArcGISRuntime::PortalItem *portalItem)

    Removes the PortalItem portalItem from the user's favorites group.

    [override virtual] void PortalUser::retryLoad()

    Reimplements: Loadable::retryLoad().

    See Loadable.

    Esri::ArcGISRuntime::PortalUserRole PortalUser::role() const

    Returns the user's role in the organization.

    QStringList PortalUser::tags() const

    Returns a list of user-defined tags that describe the user.

    QUrl PortalUser::thumbnailUrl() const

    Returns a URL to the user's thumbnail.

    [override virtual] QString PortalUser::toJson() const

    Reimplements: JsonSerializable::toJson() const.

    Returns the JSON representation of this object.

    See also JsonSerializable.

    Esri::ArcGISRuntime::UnitSystem PortalUser::units() const

    Returns the user's preferred units.

    [override virtual] QJsonObject PortalUser::unknownJson() const

    Reimplements: JsonSerializable::unknownJson() const.

    Returns the unknown JSON of this object.

    See also JsonSerializable.

    [override virtual] QJsonObject PortalUser::unsupportedJson() const

    Reimplements: JsonSerializable::unsupportedJson() const.

    Returns the unsupported JSON of this object.

    See also JsonSerializable.

    QString PortalUser::userDescription() const

    Returns the user's description.

    QString PortalUser::username() const

    Returns the user's username.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.