Hi,
I am using LicenseInfo by authenticating user to arcgis poral. The code is like this (copied from some sample):
// Create a challenge request for portal credentials (OAuth credential request for arcgis.com)
CredentialRequestInfo challengeRequest = new CredentialRequestInfo();
// Use the OAuth implicit grant flow
challengeRequest.GenerateTokenOptions = new GenerateTokenOptions
{
//TokenAuthenticationType = TokenAuthenticationType.OAuthImplicit
TokenAuthenticationType = TokenAuthenticationType.ArcGISToken
};
// Indicate the url (portal) to authenticate with (ArcGIS Online)
challengeRequest.ServiceUri = new Uri(this.PortalAccount.PortalUrl);
//// Call GetCredentialAsync on the AuthenticationManager to invoke the challenge handler
//await AuthenticationManager.Current.GetCredentialAsync(challengeRequest, false);
// Call GetCredentialAsync on the AuthenticationManager to invoke the challenge handler
Credential cred = await AuthenticationManager.Current.GetCredentialAsync(challengeRequest, false);
// Call GetCredentialAsync on the AuthenticationManager to invoke the challenge handler
// Credential cred = await AuthenticationManager.Current.GetCredentialAsync(loginInfo, false);
// Connect to the portal(ArcGIS Online) using the credential
ArcGISPortal arcgisPortal = await ArcGISPortal.CreateAsync(challengeRequest.ServiceUri, cred);
Esri.ArcGISRuntime.LicenseInfo licenseInfo = arcgisPortal.PortalInfo.LicenseInfo;
So I have PortalUser object (arcgisPortal.User ) and LicenseInfo object and I would like to know what kind of license user has (lite or basic) or at least if that user is Level1 or Level2 portal user. I just can't find it there. How can I find it ?
Thank you.
Solved! Go to Solution.
If that is not giving enough information your only option is hitting the rest API directly using HttpClient. That will give all the information available (Portal services ). Make a call to
https://[domainurl]/portal/sharing/rest/community/users/[username]?f=json and you will get a big json object with everything about the user.
As far as knowing the actual level of the Runtime license I don't know. I have always used named user approach to get a license and not used an embedded license
PortalUser.Privileges Property. Gives you an iteration of the PortalPrivilege Class. From there get the PortalPrivilege Class object and the PortalPrivilege.Role Property should give you want you want
Thank you for the answer, but I am afraid that, it didn't help me find info about license level or named user level. In PortalUser.Privileges there is a list of privileges concerning portal activity, like editing features, creating groups, etc. I have checked them all, but could not find information about my license level. I need this information because I wish to expose certain functions only to users who have basic arcgis runtime licence (named user level 2 on portal).
If that is not giving enough information your only option is hitting the rest API directly using HttpClient. That will give all the information available (Portal services ). Make a call to
https://[domainurl]/portal/sharing/rest/community/users/[username]?f=json and you will get a big json object with everything about the user.
As far as knowing the actual level of the Runtime license I don't know. I have always used named user approach to get a license and not used an embedded license
That portal service did the trick. There is information about Named user level.
I am using named user approach to get license as well, but I wish to disable certain functionality for user with lower license (level 1 named users), so I needed to know level of logged named user.
Thank you very much, that helped a lot.