on 07-02-2015 7:19 PM
Hi Experts
My requirement is want to Disable/Enable the Button in view by using the User group in Java webdynpro application
User group in SAP Portal. My version is Portal 7.0
How do we read the portal group and check whether the user belongs to that group. If user from that group i want to disable the Download button, else Ebalbe teh button.
Please provide some coding for How to read user group and how to check whether the user is belongs to that group.
1. How to read the perticulat portal group
This is the unique id for my group :
Unique ID: GRUP.CORP_LDAP.cn=test_group,ou=test,ou=secure,ou=fdor global groups,dc=fdor,dc=dor,dc=state,dc=fl,dc=us
2. then how i check whether the Loging userId in from this group.
Thanks
Rag
hi rag,
try this code.
IUser myuser=null;
myuser=userFact.getUserByLogonID(---****-------here pass your user id/login-id----*----);
Iterator groupList=myuser.getParentGroups(true);
while(groupList.hasNext())
{
String groupVal=(String)groupList.next();
}
Other wise read this threads may be help for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Durga, String groupVal=(String)groupList.next(); com.sap.security.api.IGroup g = Factory.getGroupFactory().getGroup(groupstr); Here i am getting the all groups assigned to user with all text for group. by using above code. How can we read specific Groupname or Group ID from above list. If i read get the group name from above list, then i can check against the group and set the Enable option. thanks rag
Yes,
But you need to maintain the
what i observed in groups.there are mainly two parts in data source.
1.Unique ID: GRUP.SUPER_GROUPS_DATASOURCE
2.Unique ID: GRUP.PRIVATE_DATASOURCE.un.
Here 1 point are Unique values and some permission group we can't change.
2nd point is our custom value like wdj role assign into the groups and some other.
so while creating the wdj group starting maintain any content value.So this value you can check the group list in the user and that group you can set the your option
hi rag,
just check the documentation:
http://help.sap.com/javadocs/NW04S/SPS09/se/com/sap/security/api/UMFactory.html - to get the Groupfactory
http://help.sap.com/javadocs/NW04S/SPS09/se/com/sap/security/api/IGroupFactory.html
- to get your specific group
http://help.sap.com/javadocs/NW04S/SPS09/se/com/sap/security/api/IGroup.html - to check if user is member of this group
regards,
christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use UME API for the requirements.
1) Import following package.Might be u need to add com.sap.security.api.jar ,if needed in your dc.
import com.sap.security.api.*;
2) Write below codes in your wdDoInit() method, so while user logged in to the application we can able to read the user id & can check the user belongs to specified group or not.
IUser loggedUser = WDClientUser.getCurrentUser().getSAPUser();//logged on user
boolean groupRresult = loggedUser .isMemberOfGroup(test_group, true) ; //Unique ID of your required group->test_group
3) Bind the UI element - button enable property with one boolean attribute.
3) If groupRresult is coming as true you can set your boolean attribute as true & it will enable the button. otherwise set the attribute as false so it will disable the button.
Thanks,
Patralekha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Patralekha,
I tried using your
boolean groupRresult = loggedUser .isMemberOfGroup("test_group", true) ;
test_group = GRUP.CORP_LDAP.cn=deo_test,ou=gta groups,ou=fdor global groups,dc=fdor,dc=dor,dc=state,dc=fl,dc=us
But getting an below error.
Error: the method isMemberOfGroup(String, Boolean) is undefined for type string
isMemberOfGroup - method is which API? i have trued it and it geave an error
I did imported the API in my Webdynpro component - implementation
import com.sap.security.api.*;
But this import is dis-appear when i saved/build the DC.
I am using java j2sdk1.4.2_38 was it support this method.
How to resolve this error.
I wrote the as below
String userID = "";
try {
userID = WDClientUser.getCurrentUser().getSAPUser().getUniqueName();
} catch (WDUMException e) {
//e.printStackTrace();
userID = "";
}
boolean groupRresult = userID.isMemberOfGroup("GRUP.CORP_LDAP.cn=deo_test,ou=gta groups,ou=fdor global groups,dc=fdor,dc=dor,dc=state,dc=fl,dc=us", true);
Thanks
Rag
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.