cancel
Showing results for 
Search instead for 
Did you mean: 

How to add security features to my Webdynpro application

Former Member
0 Kudos

Hi all,

I have an WD application.

I need to add authroziations to the WD applicatinon.

E.G : I deployed the application in the portal. Based on user roles and authorization the different views should be shown.

If an administrator has logged on , he can view and modify the data in the WD.

If a normal user logged on , he can only view.

Please let me know how to go about this.

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

For this first you need to create portal iViews and pages for your WD applications. Then create worksets based on the number of different types of users. In each worksets you can add only those pages which are required by a particular type of user.

Then create roles and assign the workset to the role so that a particular role will have access to only those workset which are assigned to the role.

Then create users and assign roles to them.

Hope it helps.

thanks & regards,

Manoj

Answers (6)

Answers (6)

Former Member
0 Kudos

Thanks for the helpful answers.

Former Member
0 Kudos

Hi,

If you want to apply Authentication to your web dynpro application one way is to :-

1) Double click on the Appln

2) On the right hand side there will be two tabs "Properties" and "Application Properties"

3) Go to Application properties and click on "New"

4) Select pre-defined and then Browse the Name and select Authentication

5) Select the Value as True

Finish and the authentication is applicable to your appln.

The Users having access can only see the application

Thnx!

Harry

Former Member
0 Kudos

Hi,

To reach your functionality you have to follow the below steps

1. Open the application properties and set the Authentication to true (Your Project -> Web Dynpro -> Applications -> Your Application -> Application Properties - > New -> Browse -> Authentication)

2. Get the logged in user in controller

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();

3. Check whether this user has required role/group or not

sapUser.isMemberOfRole("unique id of role",true);

or

sapUser.isMemberOfGroup("GRUP.PRIVATE_DATASOURCE.un:MyGroup",true);

4. Create the context attribute (ex: modButtonVisible) and set the type to com.sap.ide.webdynpro.uielementdefinitions.Visibility

5. Bind this attribute to button property "visible"

6. In init method after checking above 3 point set the visibility for the context attribute

wdContext.currentContextElement().setModButtonVisible(WDVisibility.VISIBLE);

or

wdContext.currentContextElement().setModButtonVisible(WDVisibility.NONE);

Hope this will solve your problem

Thanks

siddharth_jain
Active Contributor
0 Kudos

Hi ,

Check this Link :-

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1c693fcf-0201-0010-d9bb-f48b1d8c...

this tutorial describes using UME permissions to Protect Access and Provide Authorization.

You can Also do the Following.

From Webdynpro Runtime you can Get the logged in portal your and from Logged in Portal user you can get its role and Groups and according to it you can implement your requirement.

IWDClientUser user = WDClientUser.getLoggedInClientUser();

Iuser puser = user.getSAPUser();

from puser you can extract its roles and identify its groups

Siddharth

Former Member
0 Kudos

Hi Somya

1) First Create two String variables

public static final String APP_TEST_ENTRY = "TestEntry";
	public static final String APP_TEST_APPROVAL = "TestApproval";

create one Boolean value attributes in the component controller

setIsEntryView()

2) In the DoInit

String appName = wdComponentAPI.getApplication().getName();
		if (TestCompController.APP_TEST_ENTRY.equals(appName)) {
			wdContext.currentContextElement().setIsEntryView(true); 
		} else if (TimesheetEntry.APP_TEST_APPROVAL.equals(appName)) {
			wdContext.currentContextElement().setIsEmpView(false);
		}

this is one of the way to handle

Best Regards

Chaitanya.A

Former Member
0 Kudos

hi<

heres the pdf to add security features to web dynpro

Steps to Create a Simple WebDynpro Application Which Requires Authentication into Portal Before Itu2019s Accessed

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00c80a68-ac51-2b10-efa6-c3ea8f98...

This pdf misses out one thing addition of the jar files required

here are the steps

You need to add the jar files com.sap.security.api.jar. and com.sap.security.api.perm.jar.

We add these files by Right clicking on the project. Select Properties.Select Java Build Path.

Then Press the button Add External Java files and browse to the location of these files.After adding both the jar files click on OK.

this will surely help u.

Edited by: Nikhil Tapkir on Aug 22, 2008 9:11 AM