How to get Portal Login user ID and Groups using UME API in JSPDynpages
Hi Experts,
How can I get the portal logged user ID and bsed on that ID need to get his assigend groups.
For this Initially I need to get the logged user ID using UME API.
Can you drop the code to write and display using JSP Dynpages?
Thanks
Venkat.
Hi,
Try the below code
IUserFactory userfact=UMFactory.getUserFactory();
IUser user=userfact.getUserByUniqueName(request.getUser().getUserId());
String usrid=user.getUniqueName();
And also you can get the groups assigned to user by using the below code
Iterator groups = user.getParentGroups(true);
while (groups.hasNext()) {
String groupstr = (String) groups.next();
IGroup g = UMFactory.getGroupFactory().getGroup(groupstr);
response.write("Group name "g.getUniqueName()"<br>");
Regards
Suresh
Similar Messages
-
How to get Portal Login User and Its Related BP in CRM?
Hi,
An ABAP Webdynpro program is called in CRM from Portal user by a portal link. How to get the user ID and its related BP in CRM? Thanks!
The portal is integrated with ECC, and all users and BPs are maintained in ECC then replicated to CRM.
Best regards,
HaoHi,
Try the below code
IUserFactory userfact=UMFactory.getUserFactory();
IUser user=userfact.getUserByUniqueName(request.getUser().getUserId());
String usrid=user.getUniqueName();
And also you can get the groups assigned to user by using the below code
Iterator groups = user.getParentGroups(true);
while (groups.hasNext()) {
String groupstr = (String) groups.next();
IGroup g = UMFactory.getGroupFactory().getGroup(groupstr);
response.write("Group name "g.getUniqueName()"<br>");
Regards
Suresh -
How to get the NT user id and passwd
Hi,
How to get the NT user id and passwd using form 6iYou cannot get the password. Password are stored in an encrypted format. Almost never decrypted (as a security meassure). Authentication is performed by encrypting the supplied password and matching that against the stored encrypted password.
Think about it.. just how dangerous it will be to have a function that can dump NT users and their passwords for you. How can you ever expect to "simply decrypt a password"?
As for getting the user name. See the Win32 kernel API call GetCurrentUser(). Also note that there is a big difference as to the owner/user of a server process/thread versus the end-user of client application (possibly running on another PC) that is making the call to the server.
Of course, none of this is related to SQL or PL/SQL - which is what I believe the subject matter of this forum is... Kindly suggest that in future you pay attention to posting the correct subject material to the correct forum. -
How to get list of users who reset password using FIM portal
How to get list of users who reset password using FIM portal
-Thanks Rakesh SawantHi Rakesh,
I think you are looking for something like this:
Using Powershell to list all users that had completed
a password reset within the last 30 days
If you found my post helpful, please give it a Helpful vote. If it answered your question, remember to mark it as an Answer. -
How to get Folder or document service permissions by using KM API's
Hi,
Any help how to get Folder or document service permissions by using KM API's
Any help or hint is greatly appreciated.
Thanks,
Costa.Hi,
I have tested it here and it works for me (this code lists the service permissions settings for folder /documents/temp/):
RID rid = RID.getRID("/documents/temp");
try {
IUser user = (IUser) request.getUser().getUser();
IResourceContext context = new ResourceContext(user);
IResource res = ResourceFactory.getInstance().getResource(rid, context);
IResourceFactory resourceFactory = ResourceFactory.getInstance();
IRepositoryServiceFactory serviceFactory = resourceFactory.getServiceFactory();
IAclService aclService = (IAclService) serviceFactory.getRepositoryService(res, IWcmConst.ACL_SERVICE);
IResourceAclManager aclResourceManager = aclService.getAclManager();
IResourceAcl resourceAcl = aclResourceManager.getAcl(res);
boolean inheritedAcl = false;
if (resourceAcl == null) {
resourceAcl = aclResourceManager.getInheritedAcl(res);
inheritedAcl = true;
response.write("<strong>SERVICE PERMISSION OWNERS</strong><br>");
IUMPrincipalList ownerList = resourceAcl.getOwners();
IUMPrincipalListIterator ownerListIt = ownerList.iterator();
while (ownerListIt.hasNext()) {
IUMPrincipal ownerPrincipal = ownerListIt.next();
String strPrincipal = ownerPrincipal.getId();
response.write(strPrincipal + "<br/>");
response.write("<br><strong>SERVICE PERMISSIONS</strong><br>");
IResourceAclEntryList el = resourceAcl.getEntries();
IResourceAclEntryListIterator it = el.iterator();
while (it.hasNext()) {
IResourceAclEntry entry = it.next();
String strEntryPerm = entry.getPermission().getDescription();
String strPrincipal = entry.getPrincipal().getId();
response.write("<strong>" + strEntryPerm + "</strong> - principal: " + strPrincipal + "<br/>");
IAclPermissionList plList = entry.getPermission().getMembers();
IAclPermissionListIterator plListIterator = plList.iterator();
while (plListIterator.hasNext()) {
IAclPermission perm = plListIterator.next();
response.write(perm.getDescription() + "<br/>");
} catch (Exception e) {
response.write(LogWriter.extractCallStack(e));
LogWriter.traceSevere(LogWrapper.trace, e, LogWriter.extractCallStack(e), true);
Romano -
How to get the service name of a webservice using UDDI API
Hi,
Iam working on setting up a dynamic partner link in a BPEL, by passing the endpoint of a web service queried from the UDDI (Oracle Service Registry 10.3 ) using the API. Iam able to do it successfully.
Now, for example I have two operations in my wsdl, one to createCustomer and the other to bookTicket. I need to get the operation name using UDDI API so that i can pass it along with the endpoint to the partner link. ie. When i need to createCustomer, my UDDI API code will need to get the service name createCustomer and the endpoint and I would pass them to the partnerlink and the createCustomer operation of my webservice would be called.
Can any one help me to get the service names of the wsdl using UDDI APIs.
Thanks,
AnanthHi sia,
1. Table is APQI
2. field name for session name is GROUPID
regards,
amit m. -
How do I get Portal Login User Details in WD Application
Hi,
Could you please help me out as how to get the user who has logged into the portal.
Regards,
Abilash.Hi,
In you webdynpro location you can use the following code to get the logged in user details.
String strUserName = null;
try {
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
IUser sapUser = wdClientUser.getSAPUser();
if (sapUser != null) {
IUserAccount[] acct = sapUser.getUserAccounts();
if (acct[0] != null) {
strUserName = acct[0].getDisplayName();
} catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
The following import statements have to be used
import com.sap.security.api.IUser;
import com.sap.security.api.IUserAccount;
import com.sap.security.api.UMException;
import com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDClientUser;
import com.sap.tc.webdynpro.services.sal.um.api.WDUMException;
Award points if helpful.
Regards,
Sujana -
Get inf. about user, rol and group, which shows and works on my webdynpro ?
Hi everybody,
Can someone help me? I need the information about rol and group of the user, who's show and work on my webdynpro?Hi,
You can use the below code to get the information you need. You need to add the jar file com.sap.security.api.jar to your Web Dynpro project's build path.
IRoleFactory roleFactory= UMFactory.getRoleFactory();
IGroupFactory groupFactory = UMFactory.getGroupFactory();
try
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
Iterator assignedRoles = user.getRoles(true); // true means all the roles are searched recursively
Iterator assignedGroups = user.getParentGroups(true); // true means all the groups are searched recursively
while(assignedRoles.hasNext())
String roleID = (String)assignedRoles.next();
IRole role = roleFactory.getRole(roleID);
String roleName = role.getUniqueName();
// Fill your model node with the role
while(assignedGroups.hasNext())
String groupID = (String)assignedGroups.next();
IGroup group = groupFactory.getGroup(groupID);
String groupName = group.getUniqueName();
// fill your model node with group.
catch(Exception ex)
messageManager.reportException(ex.getLocalizedMessage(),false); -
Add user to sharepoint group using REST API
I am trying to add a user to sharepoint group with following code
serviceUrl= Appweb + "/_api/SP.AppContextSite(@target)/web/sitegroups("+GroupId+")/users?@target='host web'";
$.ajax({
url: serviceUrl,
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: 'json',
body: "{'__metadata': { 'type': 'SP.User' },'LoginName':'i:0#.f|membership|'+email }",
headers: {"accept":"application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest":$("#__REQUESTDIGEST").val()
async: false,
success: function (data) {
alert('success');
error: function (data) {
alert('fail');
The request goes to error function. Response of the request is Microsoft.SharePoint.Client.InvalidClientQueryException and message is A node of type 'EndOfInput' was read from the JSON reader when trying to read the start of an entry. A 'StartObject' node was
expected
I tried the sample from following link but fail it
https://msdn.microsoft.com/en-us/library/office/dn531432.aspxHi,
Per my understanding, you might want to add an user to a SharePoint group in host web from a SharePoint Hosted App using REST API.
Here is a working demo for your reference:
var hostweburl;
var appweburl;
$(document).ready(function () {
//Get the URI decoded URLs.
hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
// Resources are in URLs in the form:
// web_url/_layouts/15/resource
var scriptbase = hostweburl + "/_layouts/15/";
// SP.RequestExecutor.js to make cross-domain requests
$.getScript(scriptbase + "SP.RequestExecutor.js", loadPage);
// Utilities
// Retrieve a query string value.
// For production purposes you may want to use a library to handle the query string.
function getQueryStringParameter(paramToRetrieve)
var params = document.URL.split("?")[1].split("&");
for (var i = 0; i < params.length; i = i + 1)
var singleParam = params[i].split("=");
if (singleParam[0] == paramToRetrieve) return singleParam[1];
function addUsersInGroup() {
var executor;
// Initialize the RequestExecutor with the app web URL.
executor = new SP.RequestExecutor(appweburl);
executor.executeAsync({
url: appweburl + "/_api/SP.AppContextSite(@target)/web/sitegroups(8)/users?@target='" + hostweburl + "'",
method: "POST",
contentType: "application/json; charset=utf-8",
dataType: 'json',
body: "{'__metadata': { 'type': 'SP.User' },'LoginName':'i:0#.f|membership|[email protected]'}",
headers: {
"Accept": "application/json; odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest":$("#__REQUESTDIGEST").val()
success: addUsersInGroupSuccessHandler,
error: addUsersInGroupErrorHandler
function addUsersInGroupSuccessHandler(data)
console.log(data);
var jsonObject = JSON.parse(data.body);
console.log(jsonObject);
function addUsersInGroupErrorHandler(data)
console.log(data);
var jsonObject = JSON.parse(data.body);
console.log(jsonObject);
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]. -
How to get count of group of current login user if AD Group is added in SharePoint Group?
My Client has 2 SharePoint Application. For the AD Users they have created AD Group and added users in that AD Group as per requirement. Later AD Group is added in SharePoint Group. When I'm trying to fetch Current User Group count, I can able to get the
count of Groups using below statement.
int groupCount = SPContext.Current.Web.CurrentUser.Groups.Count;
Above Statement, returns always 0 value if I tried with User who are added in AD Group and if I add AD User and then it will return the exact count.
Please suggest solution to get Count of Group of Current User. My Application contains more than 60 SharePoint group.Hello,
I believe your code doesn't count those AD group users until they login at least once. If this is the case then try to use "SPUtility.GetPrincipalsInGroup" as suggested in below post:
http://stackoverflow.com/questions/4314767/getting-members-of-an-ad-domain-group-using-sharepoint-api
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
Get old item name for renamed files using TFS API
My current tfs will be retired in next few months.I am using tfs api to create a parallel tfs on a new server from the existing one. I have folders and solutions that have been renamed. I am iterating items and based on their changetype(add, edit, delete,
sourcerename etc), I am checking them in destination tfs.
I am not able to get Old filename for a file, in order to use PendRename when the item that is being iterated is Delete|SourceRename or Rename.
I tried the mentioned solution :
https://social.msdn.microsoft.com/Forums/vstudio/en-US/f9c7e7b4-b05f-4d3e-b8ea-cfbd316ef737/how-to-get-previous-path-of-renamedmoved-of-file-using-tfs-api?forum=tfsgeneral
But, my changeset has a lot of changes and hence identifying a particular file seems difficult.
Do we have something that interraltes two items (the deleted and renamed) ones other than the changeset, because there needs to be a uniquely identifier that associated the two items so that they may appear together in TFS history?Hi Fabcoder,
As Daniel mentioned, you can migrate source control files and work items to the new TFS server by using TFS integration tools.
If the new server has the complete history, then you can view the history of the specific file to check the pervious path. Or you can do a compare between the project in new TFS where the file located with the matched project in current TFS to check
the differences.
Best regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to get Portal user from a standalone Java application
Hi,
I have a standalone Java application from where I need to fetch the Portal User Information like userid and email id.
I am using the below line of code
iUser = UMFactory.getUserFactory().getUserByLogonID("e017939");
I have included the jar file com.sap.security.api , But it was giving me the below exception
java.lang.NoClassDefFoundError: com/sap/tc/logging/Location
at com.sap.security.api.UMFactory.<clinit>(UMFactory.java:55)
at com.am.wcas.java.mailscheduler.kmaccess.FetchDataFromKM.getiUser(FetchDataFromKM.java:29)
at com.am.ScheduleEmails.main(ScheduleEmails.java:89)
and I am getting a pop Up message from the Java Virtual Machine Launcher, saying a Fatal Exception has occured and the Program will exit.
Then I went throught he SDN threads and they asked me to include the
logging.jar and com.sap.security.perm.api .
I Included them, then also, it is giving me Exception
java.lang.NoClassDefFoundError: com/sap/engine/lib/logging/LoggingHelper
at com.sap.security.api.UMFactory.<clinit>(UMFactory.java:56)
at com.am.FetchKMData.main(FetchKMData.java:30)
Exception in thread "main"
and I am getting a pop Up message from the Java Virtual Machine Launcher, saying a Fatal Exception has occured and the Program will exit.
Kindly let me know if it is possible to access the User info using UMFactory in a standalone Java application. If yes kindly let me know where i am going wrong.
Regards,
Shilpa B.VHi Shilpa,
1. Check that you have added com.sap.security.api within the Your Project>Libraries folder (under navigation tab) and also added jars in the build path of the Your Project under project>properties>Build Path.
2. In case you have a DC instead of Web Dynpro Project then you have to add the com.sap.security.api under Your DC>Used DCs and have compile time and runtime dependency added.
Here java.lang.NoClassDefFoundError is caused basically due to only build time dependency added and reference to the jar missing at runtime. Rest the code to retrieve the current user id using UME API and getUserByLogOnID("....") method with/without portal environment would not be an issue at all.
Regards,
Tushar SInha -
How to access Sap portal login user in ejb web service
Hi,
I wnt to access SAP Portal login user in my ejb application which resides on the same server.
I am using following code
try {
IUser user =null; IWDClientUser wdUser = WDClientUser.getCurrentUser();
user = wdUser.getSAPUser();
} catch (WDUMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Some additional jar files are required for this?
The same code works fine with webDynpro but not with ejb.
Thanks in advance
Best regards,
NileshThanks for reply.
I have already added com.sap.security.api in my EJB module project classpath. How to add the same in EJB application Project (application-j2ee-engine.xml)?
Best regards,
Nilesh -
How to get the current user logon to portal?
Hi Gurus,
How to get the current user who logged into portal.
I have a webdynpro requirement where in which I have to get the current user id who loggedinto portal which will be the input parameter of the BAPI(adaptive RFC model) which will return me employee number of the particular user.
Can anyone send me the code to retrive the user id through webdynpro application..........
Pts will be rewarded for useful inputs......
Thanks in Advance,
DharaniHi Dharani,
Using UMEfactory u can do that...
1. create one input field,
2. create one attribute called Uid
3. assign Uid attribute to the input field
4. type the following code in Doinit() method
String uid = wdContext.currentContextElement().getUid();
try {
IUser user = UMFactory.getUserFactory().
getUserByLogonID(uid);
String userName = user.getDisplayName();
} catch (UMException ex) {
e.toString();
5. after that go to Portal create one iview assign to particular user. then u get into the user details...
thats it
Regards,
P.Manivannan -
How to get to see the usernames and passwords for wifi logins on iPad
How to get to see the usernames and passwords for wifi logins on iPad.
You can't access that on an iPad. The iPad does not have a Keychain Access type app like the Mac has. Maybe an application like iExplorer on your Mac will let you see them, but you can't see them on the iPad itself.
Maybe you are looking for
-
Excise invoice cancel process for depot plant
Hi, We have made the GR and also capture the excise details with J1IG for depot, now due to some problem we want to cancel both tge GR and RG entry, so which transaction to be use to reverse the entry of J1IG. regards, zafar
-
A problem with Static/RSS ticker
Hello everyone! I have a test lab set up (DMM 5.1 and DMP-4305G, license is OK). I made a few presentations with Cisco Digital Media Designer that included video, text ticker and RSS ticker. Video works fine. Static text ticker almost works perfect,
-
Installing Flash player doesn't finish Step 3 Prompt to buy another product
Installing Flash player, after completing Step 2, I'm prompted to buy other products, which I don't want to do. Anybody have a link that actually completes all steps? Safari browser is not loading pages. Need help asap. Thanks!
-
I'm from Finland and when I joined Creative Cloud, I soon found out that Creative Cloud signing in doesn't work in Finnish even though it is possible to install some programmes in Finnish. So I uninstalled everything and installed all the programmes
-
Hi, I can not get Organizer 9 to show only the matching photos when clicking on a name tag. When I apply a tag to a specific photo within a group of photos stored in the same file, or when I attach different tags to a set of photos, Organizer shows a