Skip to Content
avatar image
Former Member

Regd. Accessing the ViewController of the Used DCs.

Hi Gurus,

I have a question regarding designing an appl which is intended to do this.

Say, we have two roles, Employee and Manager.

Employee can create some requests and the Manager can approve or reject them along with some additional functionality as well. At times, the Manager could even edit some of the requests that the Employee has created.

Initially, we designed like this.

DC1 - Containing views to be accessed by the Employee

DC2 - Containing views that can be accessed by the Manager.

In such a case, how can the Manager (DC2) access views of the Employee (DC1)? Using DC1 in DC2 doesnt help, coz, the ViewController is private to the DC1 component.

I feel our design approach was wrong, could you please suggest a better approach?

Any suggestions would be greatly appreciated.

Thanks in advance.

Anjana Raghav.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jun 06, 2008 at 08:55 PM

    > In such a case, how can the Manager (DC2) access views of the Employee (DC1)? Using DC1 in DC2 doesnt help, coz, the ViewController > is private to the DC1 component.

    1. Create New Public Part in DC1 with entity type "Web Dynpro Component". Build your DC.

    2. Go to DC2, Add DC1 public part to "Used DCs" and to "Used Web Dynpro Components". Create "ViewContainderUIElement" in View. This element will act as Place holder for window of DC1. Now "Embed View" and "Embed Interface View of a Component instance" of DC1.

    Now you should be able to reuse view created in DC1 in DC2.

    > I feel our design approach was wrong, could you please suggest a better approach?

    > Any suggestions would be greatly appreciated.

    For this use case, I would use UME Permissions to display appropriate things for Employee / Manager. Create DC of type "UME Permissions" with the following actions.

    <BUSINESSSERVICE NAME="SelfServiceActions">
      <DESCRIPTION LOCALE="en" VALUE="UME Actions for Employee / Manager" /> 
    <!-- These actions  appears in usermanagement console to assign to roles -->
      <ACTION NAME= "Employee">
           <DESCRIPTION LOCALE= "en" VALUE= "Employee User" />
     <!-- Value has no significance when NamePermission is used -->     
           <PERMISSION CLASS= "com.sap.security.api.permissions.NamePermission"
             NAME= "Employee" VALUE= "*" />
       </ACTION>
    
      <ACTION NAME= "Manager">
           <DESCRIPTION LOCALE= "en" VALUE= "ATS Uploader" />
           <PERMISSION CLASS= "com.sap.security.api.permissions.NamePermission"
             NAME= "Employee" VALUE= "*" />
           <PERMISSION CLASS= "com.sap.security.api.permissions.NamePermission"
             NAME= "Manager" VALUE= "*" />
       </ACTION>  
    </BUSINESSSERVICE>

    Now in Employee / Manager application would something like this. Assign appropriate UME Action to user from User Admin Console.

    IUser user = WDClientUser .forceLoggedInClientUser().getSAPUser();
    NamePermission employee = new NamePermission("Employee");
    NamePermission manager = new NamePermission("Manager");
        
    if(user.hasPermission(manager)) {
       //Here display / do  the  things  required only for Manager. Like you  display some buttons 
    }
    else if(user.hasPermission(employee)) {
      //Here you can disable or hide the buttons meant for Manager
    } 
    else  {
       //This is optional section.
       //Protect yourself - If someone know direct Web Dynpro URL but don't have portal roles this this would be helpful.
        wdComponentAPI.getMessageManager().reportException("You are not authorized to use this app", true); 
        return;
    }

    Cheers,

    ~kranthi

    Add comment
    10|10000 characters needed characters exceeded