Programmatical Approach to User Management in Enterprise Portal

Similar documents
POWL: Infoset Generation with Web Dynpro ABAP

Integration of Web Dynpro for ABAP Application in Microsoft Share Point Portal

Easy Lookup in Process Integration 7.1

How to Reference External JAR Files in Web Dynpro DC in SAP NW Portal 7.3

Add /Remove Links on ESS Home Page in Business Package 1.5

Graphical Mapping Technique in SAP NetWeaver Process Integration

Fetching User Details from the Portal and Displaying it in Web Dynpro with Authentication in the Portal

Material Master Archiving in Simple Method

How to Create and Schedule Publications from Crystal Reports

Custom Password Reset Tool in SAP Enterprise Portal Using Web Dynpro for Java

Adding Files as Attachments to SAP Interactive Forms in the Java Environment

MDM Syndicator: Custom Items Tab

Material Listing and Exclusion

SDN Community Contribution

Calculate the Number of Portal Hits Part 2

This article explains the steps to create a Move-in letter using Print Workbench and SAPScripts.

How to Upload a File into the Knowledge Management (KM) Repository using KM API.

E-Sourcing System Copy [System refresh from Production to existing Development]

SDN Community Contribution

MDM Import Manager - Taxonomy Data (Attribute Text Values) Part 3

Financial Statement Version into PDF Reader

Filtering Portal Content Based on User Attributes

Config Tool Activities

SDN Community Contribution

Limitation in BAPI Scheduling Agreement (SA) Create or Change

Displaying SAP Transaction as Internet Application in Portal

Creating Custom SU01 Transaction Code with Display and Password Reset Buttons

How to Create Top of List and End of List of the ALV Output in Web Dynpro for ABAP

Open Text DocuLink Configuration - To Access Documents which are Archived using SAP

SDN Community Contribution

Using Radio Buttons in Web Template

DB Connect with Delta Mechanism

Linking Documents with Web Templates

Open Hub Destination - Make use of Navigational Attributes

Table Row Popup in Web Dynpro Component

Exception Handling in Web Services exposed from an R/3 System

Creating Rules in Process Composer and using them in Process

SAP Biller Direct Step by Step Configuration Guide

SAP BI BO Unit/Currency Logic for Unknown Units Case Study

Federated Portal for Composite Environment 7.1

SUP: Personalization Keys and Synchronize Parameter

How to Default Variant Created for Report Developed In Report Painter/Writer

List of Values in BusinessObjects Web Intelligence Prompts

BAPI Execution in offline Adobe Form

Universal Worklist - Delta Pull Configuration

Standalone BW System Refresh

Federated Portal Network Remote Role Assignment Step-by- Step Configuration

About ITAB Duplicate_Key (SAP lrsaods) Runtime Error

How to Create and Execute Dynamic Operating System Scripts With XI

Extracting Missing Fields of Data Source Which Are Present In Their Extract Structure

Step by Step Procedure for DSO Creation

Maintaining Roles and Authorizations in BI7.0 - RSECADMIN

How to Configure User Status in mysap SRM

Database Statistics During ODS Activation

Process Chain Log Deletion

Dialog Windows in WebDynpro ABAP Applications

Validity Table in SAP BW/BI

SAP PI/XI: Generating Sequence Number Between Multiple Instances of Mapping Execution

Solution to the Challenges in Pivoting

ecatt Part 6 System Data Container

Recreating BIA Indexes to Address the Growth of Fact Index Table

Extraction of Hierarchy into Flat File from R/3 and Loading in BW System

Step By Step: the Process of Selective Deletion from a DSO

Information Broadcasting Part 3 Scheduling the First Report

Printer Landscape Made Easy!!

How to use Boolean Operations in the Formula as Subsidiary for IF Condition

How to Display Result Row in One Line While Reporting On Multiproviderer

How to Download Multiple Files in ZIP using WebDynpro Java

Creating Multiple Methods/Operations and Exposing BAPI as a Webservice

Template Designer: Create Automatic PDF Documents for Attachment or Print Purpose

Explore to the Update Tab of Data Transfer Process in SAP BI 7.0

Step By Step Procedure to Implement Soap to JDBC Scenario

SMT (Service Mapping Tool)

A Step-by-Step Guide on IDoc-ALE between Two SAP Servers

Developing Crystal Reports on SAP BW

Step by Step Guide How to Use BI Queries in Visual Composer

Step by Step Guide for PI Server Start and Stop Procedure

Upload Image file from system in Web dynpro view

SDN Community Contribution

Material Master Extension for New Plant

Step by Step Method for File Archival in BW

Dynamically Enable / Disable Fields in Table Maintenance Generator

Freely Programmed Help- Web Dynpro

MDM Syndication and Importing Configurations and Automation

Creating, Configuring and Testing a Web Service Based on a Function Module

HOWTO: SCRIPTING LANGUAGE SUPPORT FOR SAP SERVICES - RUBY

Step by Step Guide on How to Use Cell Definition in BEx Query

Creation of Sets in SAP-ABAP, How to Read them INI SAP-ABAP Reports

Web Dynpro ABAP: Dynamic Table

Replacement Path: Explained with an Illustrated Example

Data Extraction & DS Enhancement in SAP BI Step by Step

Setting up Connection between BW and R/3 for Data Load

Web Dynpro: Coloring Table Conditionally

Currency Translation in SAP BI Step by step Guide

Transfer Material Attributes (Material Type) from R/3 to SAP GRC Global Trade Services (GTS)

SAP QM-IDI Interface. SDN Contribution. Applies to: Summary. Author Bio. SAP QM Interfaces

ABAP HR: Standard Info Type Enhancement

External Driver Configuration for Process Integration 7.0

Implying Security on Business Object XI 3.1 Universe having SAP BW as Source

Step-By-Step guide to Virtual InfoCube Implementation

Transcription:

Programmatical Approach to User Management in Enterprise Portal Applies to: SAP Netweaver 2004 SPS15/ SAP Enterprise Portal 6.0 or higher. Summary This article provides information to create user in EP, assign custom roles to a user, assign user to a group, assign group to a role and deleting user. Author(s): Milton Ghosh Company: HCL Technologies Created on: 18 June 2007 Author Bio Milton Ghosh is working as a NetWeaver consultant for HCL Technologies Kolkata 2007 SAP AG 1

Table of Contents Brief Outlook of User Management... 3 Interfaces in Use... 4 Create a new user... 5 Assign Role to User... 7 Assign User to Group... 7 Assign Group to Role... 8 Deleting an User... 9 User Management Access... 9 Related Content... 10 Disclaimer and Liability Notice... 11 2007 SAP AG 2

Brief Outlook of User Management User Management Engine is the central location for storage of user and role information for JAVA as well as ABAP applications using UME. The UME API provides for uniform access to various objects. User Management and Authorization ( included in package com.sap.security.api ) UMFactory IUser IUserAccount IGroup IRole Access Control List Management ( included in package com.sap.security.api.acl ) IAcl IAclManager 2007 SAP AG 3

Interfaces in Use IUser: This interface provides only read access to the user information, and offers basic support for authorization. IUserMaint: The IUserMaint interface extends the interface IUser and offers the methods to change user information. IUserAccount: This interface is used to get and set user account data for instances passwords, roles and group membership. IUserFactory: The interface provides means to instantiate user objects, create new users, delete users, and search for users based on different criteria perform mass commit/rollback operations on a set of users. IGroupFactory: The interface provides means to instantiate group objects create new groups, delete groups, and search for groups based on different criteria perform mass commit/rollback operations on a set of groups. IRoleFactory: This interface provides methods to access, create, search and delete roles. All of the above Interfaces belong to the com.sap.security.api package. 2007 SAP AG 4

Create a new user The values of name, Id, email etc is shown in the code as hard coded. import com.sap.security.api.igroupfactory; import com.sap.security.api.lfactory; import com.sap.security.api.iuseraccount; import com.sap.security.api.iuserfactory; import com.sap.security.api.iusermaint; import com.sap.security.api.iusersearchfilter; import com.sap.security.api.umexception; import com.sap.security.api.umfactory; public static void createuser throws UMException { IRoleFactory rolefact = UMFactory.getRoleFactory(); IGroupFactory groupfact = UMFactory.getGroupFactory(); IUserFactory userfact = UMFactory.getUserFactory(); IUserMaint epuser = null; IUserAccount useracc = null; try { epuser = userfact.newuser( miltong ); epuser.setfirstname( Milton ); 2007 SAP AG 5

epuser.setlastname( Ghosh ); epuser.setemail( milton.ghosh@gmail.com ); epuser.save(); epuser.commit(); try { useracc = UMFactory.getUserAccountFactory().newUserAccount( miltong, epuser.getuniqueid()); useracc.setpassword( milton@123 ); useracc.save(); useracc.commit(); catch (Exception e) { System.out.println(e.toString()); return; catch (Exception exp) { System.out.println(exp.toString()); epuser.rollback(); 2007 SAP AG 6

For already existing account we may modify flag or certain properties in the following way try { useracc = UMFactory.getUserAccountFactory().getMutableUserAccount (epuser.getuniqueid()); //change password from old to new useracc.setpassword ( milton@123, milt@1234 ); // set the password change required attribute to false useracc.setpasswordchangerequired(false); useracc.save(); useracc.commit (); catch (UMException ex) { String.out.println(ex.toString()); Assign Role to User Consider an already created role named eprole. String uniqueidofuser = epuser.getuniqueid(); String uniqueidofrole= UMFactory.getRoleFactory().getRoleByUniqueName("pcd:portal_content/com.sap.customRoles/epRole").get UniqueID()); UMFactory.getRoleFactory().addUserToRole( uniqueidofuser, uniqueidofrole); Assign User to Group Consider an already created role named epgroup. String uniqueidofuser = epuser.getuniqueid(); String uniqueidofgroup = UMFactory.getGroupFactory().getGroupByUniqueName("epGroup").getUniqueID()); 2007 SAP AG 7

UMFactory.getGroupFactory().addUserToGroup(uniqueIdOfUser, uniqueidofgroup); Assign Group to Role String uniqueidofrole= UMFactory.getRoleFactory().getRoleByUniqueName("pcd:portal_content/com.sap.customRoles/epRole").get UniqueID()); UMFactory.getRoleFactory().addGroupToRole (uniqueidofgroup, uniqueidofrole) ; 2007 SAP AG 8

Deleting an User try { IUser user = userfact.getuserbylogonid( miltong ); userfact.deleteuser(user.getuniqueid()); catch (UMException ex) { String.out.println(ex.toString()) ; User Management Access The below part is to be added to portalapp.xml to add a sharing reference to usermanagement. <application> <application-config> <property name="sharingreference" value="com.sap.portal.htmlb.usermanagement" /> <property name= releasable value= true /> </application-config> <components> </components> </ application> Moreover to make available the UserManagement API, the jar file com.sap.security.api.jar must be referred. 2007 SAP AG 9

Related Content Please include at least three references to SDN documents or web pages. http://help.sap.com/saphelp_nw2004s/helpdata/en/69/3482ee0d70492fa63ffe519f5758f5/frameset.htm https://help.sap.com/javadocs/nw04/current/um/index.html 2007 SAP AG 10

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document. 2007 SAP AG 11