Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
pankaj001
Participant

Applies to:  NW 2004 SE SP9 and above, developed and tested on NW2004SSP18.

Summary: After Portal upgrade the roles were removed from users, now the requirement was to assign roles to users in two different ways. First requirement was that, there is Role1 which is given to some Users now the Role2 is to be assigned to all the users who have the previous Role i.e. Role1. Second Requirement was to give a user all the roles of some other user.

Preconditions:

The following are the preconditions that we need.

  • Basic Concepts of Java programming.
  • An overview of Web Dynpro Programming

Before Deploying our Web Dynpro Application we should check whether the configuration settings for the J2EE server and for the SDM server are entered correctly in the Netweaver Developer Studio or not. To check the server settings, we have to choose the menu path Window => Preferences=> SAP J2EE Engine

Web Dynpro:

Web Dynpro is a client-independent programming model of the SAP NetWeaver technology platform for developing user interfaces for professional business applications. It is based on the model view controller paradim which ensures that the business logic is separated from the presentation logic. This architecture is visible in the Web Dynpro perspective of the SAP NetWeaver Developer Studio (NWDS).

Web Dynpro helps you with the development of Web applications by:

  • Ensuring platform-independence with the meta model approach
  • Minimizing the implementation effort through declarative programming
  • Supporting a structured design process by applying the model view controller paradigm
  • Providing reuse and better maintainability by using components
  • Providing graphical support with tools in the Web Dynpro perspective
  • Providing the SAP NetWeaver Java Development Infrastructure (NWDI) which supports team work with different    services such as source code versioning and the Central Build Service.

User Management Engine (UME) :

The user management engine (UME) offers a comprehensive API to manage user, roles, groups and the associates access control lists (ACLs). The implementation is based on the Portal Content Directory (PCD) and inherits some of its characteristics.

The UME API works with persisted data and the data has to be consistent on different portal nodes. This makes calls to the UME API rather complex. Performance often depends on the structure that is used to represent the data and is also affected by the cluster-communication to synchronize the collaborating nodes.

Package com.sap.security.api

For details about the classes please refer com.sap.security.api Class Hierarchy (Security (Netweaver 2004S SPS 09))

Now as we are familiar with the Interfaces and classes which are to be used, let us discuss about the development setup.

The Development Setup:

The first thing which we need to do is to finalize the development setup. Since we are developing a Web Dynpro application. We need to create the Development Components (DCs) for Web Dynpro application.

Step 1: Create a New WebDynpro Application Project

For creating a new WebDynpro Application project:

  1. Start NetWeaver Developer Studio
  2. Choose File → New → Development Component Project→ Local Development→ My Components→ Next→ Provide enteries (Vendor, Name, Domain: Enterprise Portal, DC Type: Web Dynpro ) → Next→ Finish.

Development Components:

For this scenario, I have created two DCs one as the portal application project and the other for including external libraries.

Before proceeding, I would like to say you can create External Library DC same as step 1 only thing which will differ is the value of DC type earlier it was Web Dynpro now choose DC type to “External Library”.


The structure of DCs for development

Create Web Dynpro Component, Views, Window.

The structure of DC will look like.

RoleTransferView : In this view there are two EVS which are pre populated with portal roles one for Assigned role and another for New role. Now suppose,

  • A user choose Role1 in Assigned role and Role2 in New Role and clicks on Assign button then all the users who have Role1 are also assigned Role2.
  • A user choose Role1 in Assigned role and Role2 in New Role and also check the Remove assigned role checkbox and then clicks on Assign button then all the users who have Role1 are assigned Role2 and Role1 is removed from all those users.

Layout and Outline of RoleTransferView:

TransferByUser View : In this view  there are two InputFields one for Assigned user and another for new user. Now Suppose.

  • A user inputs User1 in Assigned user and User2 in New user input fields and then clicks on Assign button then all the roles of User1 are assigned to User2.
  • A user inputs User1 in Assigned user and User2 in New user input fields and checks the checkbox remove assigned role and then on clicking Assign button all the roles of User1 are assigned to User2 and already assigned roles of user2 are removed.

layout and Outline of TransferByUser View:

TransferByRole View Layout and Outline:

In Property Tab of all the three views ADD the Required Controllers

Create Simple Type for EVS:

For creating simple types follow Creating Extended Value Selector (EVS) - Static and Dynamic in Web Dynpro for Java



Browse the type property of assignedRole context value attribute and choose the Simple Type created.

Repeat the same for newRole value attribute too and choose the simple type created.

And Map them with the InputField for assigned role and new role resp. in TransferRoleView.

For newRoleName value attribute make the calculated property as true.

Do the same for RoleName value attribute, and Map both (newRoleName and RoleName) with the Textviews in the TransferRoleView layout .

For removeRole value attribute the type property is Boolean and Map this with the checkbox in the TransferRoleView layout.

Code in wdDoInit() of RoleTransferView for populating the EVS with portal roles.


Code in getRoleName() to get the display text of EVS as the value for the Textview UI in RoleTransferView.

Code in getNewRolename() to get the display text of EVS as the value for the Textview UI in RoleTransferView.

Code under onActionassignRole() which is assign to “Assign”button of RoleTransferView.

Code under onActionassignRole which is assign to “Assign” button of  TransferByUser view.

Embed the views (RoleTransferView and TransferByUser) in TransferByRole view as Tab Contents.

Create WebDynpro application, Build and deploy the DCs and then run.

Output Screen will look like:



Related Contents

http://help.sap.com

http://wiki.sdn.sap.com

Labels in this area