PCD Filter on Worksets

Dear Experts,
We have a requirement wherein we need to restrict access to worksets within a portal role based on the department. We followed steps as given below:
At the Role level
1) Create property for Role with id com.mindtree.portal.pcd.gl.FilterAssignment.
2) Assign value com.mindtree.GroupFilter to this property.
At the workset level
1) Create property for Role with id com.mindtree.group.
2) Assign value "Admin" to this property.
We created a component following the article [Filtering Portal Content Based on User Attributes|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/5021a57d-0601-0010-6097-ec94a09c626d].
But still the workset is visible to all employees and is not getting filtered based on the department.
Please suggest.
Best Regards
Gaurang Dayal

Dear Prashant,
Thanks for writing.
I'm using IUSER to fetch the user department.
Please find the code for getObjectInstance below:
          String filterExpression = "";
          env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
          env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
          IUser user = (IUser) env.get(IPcdContext.SECURITY_PRINCIPAL);
          boolean superAdmin = false;
          // Get the role associated with the role name super_admin_role
          IRole role = null;
          String roleName = "super_admin_role";
          IRoleFactory rfact = UMFactory.getRoleFactory();
          try
               role = rfact.getRoleByUniqueName(roleName);
          catch (UMException e)
               log.severe("FILTER SERVICE: Error = " + e.toString());
          //check to see if the user is a member of the super admin role, if so, set superAdmin = true
          if(user.isMemberOfRole(role.getUniqueID(),true))
               superAdmin = true;
          if (user != null)
               String dept = user.getDepartment();
               if(dept==null)
                    dept="none";
               //override to check if the user is a member of the super admin role
               if (!superAdmin)
                    if ((dept != null) && (!dept.equals("")))
                         filterExpression = "(|(" + CountryFilterService.ATTRIBUTE_KEY + "=" + dept + ")(" + CountryFilterService.ATTRIBUTE_KEY + "=ALL))";
          return filterExpression;
Please let me know if you need some other details.
Best Regards
Gaurang Dayal

Similar Messages

  • Not able to get current user in PCD Filter factory implementation method

    hi all,
      In the  PCD Filter factory implementation method . i am using the following code
    public Object getObjectInstance(Object arg0, Name arg1, Context arg2, Hashtable env)
         throws Exception
              if (Constants.ASPECT_NAVIGATION.equals(env.get(Constants.REQUESTED_ASPECT)))
              IUser user = (IUser) env.get(IPcdContext.SECURITY_PRINCIPAL);
              String department="null";
              if (user != null)
                 department=user.getDepartment();
                   if ((department != null) && (!department.equals("")))
              filterExpression = "(" + FilterDepartmentService.Department_ATTRIBUTE_KEY + "=" + department + ")";                             
              return filterExpression;
    but i cannot able to get the current user. how to get the current user in the above method..
    Regards,
    Shanthakumar.

    Hi,
      First print the output for env.get(IPcdContext.SECURITY_PRINCIPAL);
    If it returns null, set it from the request object first (from the method where Hashtable is declared and request obj is available) and then use it in this getObjectInstance method.
    env.put(IPcdContext.SECURITY_PRINCIPAL, request.getUser());
    Regards,
    Harini S

  • Pcd filter

    Is it possible to access the request object ( IPortalComponentRequest ) in the PCD Filter factory implementation method ( getObjectInstance( ....) )
         public Object getObjectInstance(Object arg0, Name arg1, Context arg2, Hashtable env)
         throws Exception
               // Need to get the request object ???

    Were you able to get request object from filter factory class? Or did you find any alternative for that?
    Please let me know if you know the answer.
    You can contact me direclty
    chetan.

  • PCD Filter gives null page titles.

    Greetings.
    I have a portal using PCD filters according to the user language. I have a workset which have 10 pages, 5 for a language and 5 for another and the filter is applied over the workset. It was working ok for a long time, now it shows the 5 pages on the first language, but when I try changing the user language with an app then it shows the 5 titles of the pages but all with u201Cnullu201D as a title.
    The first page is showing but the others dont show up the content, only the nested menu under them all with null values.
    Do you know how could this happen? Or how could I debug the portal to determine this? u2026or look for a trace? u2026Iu2019m getting nothing on the default trace.
    Thanks in advance.
    Best regards.
    Jean Carlo

    Hi  907051,
    See,it's irony to say that if everything is covered under documentation, then probably there is no need of Webcenter Portal 's implementation expert or developers or even architect.
    Every bits will be done by customer itself with having some english knowledge to comprehend the documentation and follow blindly.
    I don't mean to hurt you but telling you one simple point is that , since you raised an issue, I just replied with some probable workaround.
    Any way, have a nice day.
    Regards,
    Hoque

  • Need PCD filter or converter to open old photo disc files

    Is there a filter or file converter to open old files from photo CD's
    Some files are PCD format and some files are PCT/Quickdraw
    The PCD files can be converted with Apple Store's Best Image Converter XV but the resolutions seem low.
    The QuickDraw (Some kind of Pict?) image can be opened in Preview but only exported as a pdf which in turn needs another conversion to jpg or tif.
    Photoshop seems to have dropped support for both these formats.
    Unfortunately I have a few hundred of these files.

    Which version of mac os x are you using?
    Which version of photoshop do you have?
    The mac version of Photoshop cc 2014 stills opens a pict file i transferred over from mac os 9
    iphoto should be able to import the pcds off the photo cd
    If you don't have the original kodak photo cd, then you could use
    pcdmagic
    https://sites.google.com/site/pcdmagicsite/
    or
    Graphic Converter 9, which should handle both pcd and pict
    http://www.lemkesoft.de/en/image-editing-slideshow-browser-batch-conversion-metadata-and-m ore-on-your-mac/
    Also, Photoline handles both pcd and pict files
    http://www.pl32.com/

  • PCD Filter using RFC call

    does any body has done PCD filtering by reading filter attribute using RFC?
    I have created one CountryFilter that read country information from RFC. I am using Java connector Framework to connect to RFC. It is working fine but my concern is about performance. I have put some debug message in R/3 function module. and what I have noticed is that RFC is called 7 times to filter one page
    _Does any body have any idea that what is the good practice? Is it really good idea to use RFC call in Filtering PCD content.?_
    My code looks like below
    java code looks like below
    class CountryFilterFactory
    method getObjectInstance()
    calling RFC and getting Country value from R/3 system
    return filterexpression
    I have also put debug message in getObjectInstance method of factory class. and I also noticed that getObjectInstance() method is also called several times.
    Thanks
    Chetan Patel.

    HI AVIK SANYAL 
    I don't understand what you want to say. I have made seperate java clas to call RFC. But as getObjectInstance is calling so many time so RFC .....I don't know anything about storing the value in session. Can you please tell me in detail how to do that
    Thanks
    Chetan.

  • PCD FIlterings

    Hello All,
    I am trying to find out a simple document which consists of steps to apply PCD filtering on Worksets/Pages but didnt find any.
    I have found a few documents but didnt understand much about how to apply PCD filtering.
    Further more do we require NWDS to apply PCD filters.
    Please help me.
    Thanks in Advance.
    Disha.

    Hi Disha,
    You may like to refer
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/5021a57d-0601-0010-6097-ec94a09c626d?QuickLink=index&overridelayout=true
    FEATURED EVENTS
    Filtering Role Content by User Attributes
    Yes you will have to write custom code to apply PCD filter and for that you will need NWDS.
    Thanks
    Prashant

  • Authorization on Workset

    Hi Experts,
    I want to hide an Workset, which is added to a Role, based on user authorizations.
    For example, USER1 can see the one workset in the Role but USER2 should not be able to access it in the same Role. I want to achieve it without creating two separate Roles for each user.
    Thanks,
    Srinivasu

    Hi Srinivasu,
    This cannot be achieved by configuration solely, as in general, the roles are the leading concept what is offered within the navigation. You could still use merging so that User2 has access to a common set of content and User1 has an additional role which merges with the first one, offering an additional workset.
    The only alternative would be to implement a PCD filter, see http://www.sdn.sap.com/irj/scn/events?rid=/library/uuid/17968de1-0a01-0010-1f9f-c090fbc7001a&overridelayout=true
    Hope it helps
    Detlev

  • How to Track All Changes In Portal

    Hi All,
    Here is my requirement.
    I need to create a portal application, this application should  trigger an email if there is any change in the portal. Lets say if someone changed the property of a portal Iview or page or workset or role  it should trigger a email with which  property changed by whom at what time.
    in Simple any changes in PCD should trigger a email with changes.
    Please advice me on how to do this requirement.
    Regards
    Praveen

    Hi Praveen,
    I think you can achieve this thru a custom PCD filter.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/17968de1-0a01-0010-1f9f-c090fbc7001a
    If you just want to know the what properties are different in each object and all. You can do it thru PCD Inspector. Suppose you are checking in QA system, you can import the business package(epa file) from dev system and compare the 2 objects.
    -Aarthi

  • Portal role

    Hi all,
    Can you help me with the portal role
    I have
    3 role : role_A / role_B / role_C
    2 workset : workset_A / workset_B
    5 iviews : iviews_A / iviews_B / iviews_C / iviews_D / iviews_E
    The user with the role "role_A" see that :
              - Workset_A with the Iviews iviews_A
              - Workset_B with the Iviews iviews_C and iviews_D
    The user with the role "role_B" see that :
              - Workset_A with the Iviews iviews_A and iviews_B
              - Workset_B with the Iviews iviews_C and iviews_D
    The user with the role "role_C" see that :
              - Workset_A with the Iviews iviews_A and iviews_B
              - Workset_B with the Iviews iviews_C, iviews_D and iviews_E
    I would like have only 2 workset.
    Is it possible to manage the iviews autorizations depending on the role ?
    Or it's necessary to create 6 workset.
    Thanks for your help
    Céline

    Hi,
    You can use PCDFilter for this.
    PCDFilter -- This dynamically can hide Role Contents depending on the filter criteria. But this feature is unusable with NavigationCaching.
    Check this for more:
    Be Careful When Combining Navigation Cache, PCD Filter
    Filtering Role Content by User Attributes
    Regards,
    Praveen Gudapati

  • Reg: How to add role to a role programitically.

    Hi All,
    How to add a role to another role programmatically ?
    My requirement is...
    I have a super role S1 which has two sub roles R1 and R2.
    I have two schedulers running. When scheduler-1 runs, I want role R1 to be added to super role S1 and the role R2 to be removed. When scheduler-2 runs, I want the role R2 to be added and role R1 to be removed from role S1.
    Now my question is...how to add the sub roles programmatically to super role?
    Thanks,
    Shilpa.

    Hi Shilpa,
    sounds like you want to provide users with different content at different times. Have you ever heard about PCD Filtering? PCD Filtering allows you to hide or show parts of the content using arbitrary filter expressions. I guess you could also implement a PCD filter which filters content depending on the current time.
    Check the article <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3367e690-0201-0010-d285-c69bd884c9f3">Filtering Role and Workset Content</a>, Shantanu's blog <a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6370">Filtering Role Content by User Attributes</a> and the presentation <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/17968de1-0a01-0010-1f9f-c090fbc7001a">FilteringRoleand WorksetContentforDevelopers</a> for more information about PCD Filters.
    Best regards,
    Martin

  • Controlling role visibility through code

    Hi All,
    I need to be able to hide worksets and roles depending upon the user that logs in. I have managed to control iviews and pages using the following code
    Hashtable env = new Hashtable();
    env.put(
           Context.INITIAL_CONTEXT_FACTORY,
           IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env.put(Context.SECURITY_PRINCIPAL, request.getUser());
    env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
    InitialContext iCtx = null;
    try {
    iCtx = new InitialContext(env);
         IiView result = null;
         Object currentObject  =  iCtx.lookup(iViewID);
         if (currentObject instanceof IiView) {
                               result = (IiView)currentObject;
         }else{
         result.putAttribute("com.sap.portal.navigation.Invisible",invisibleValue);
         result.save();
    } catch (UnsupportedOperationException e) {
                                                      e.printStackTrace();
    } catch (NamingException e) {
         e.printStackTrace();
    } catch (ValidationException e) {
         e.printStackTrace();
    } catch (IOException e) {
         e.printStackTrace();
    After looking around some more, i thought there must be something similar for worksets and roles as well.
    I found the use of IRoleService and IRoleDescriptor. But its only given how to create new roles using these. Can someone help me out on how to access existing roles so that I can set the property dynamically  for them?

    Hi Malita,
    The approach you have followed is not scalable. you should use PCD filter.
    Refer to
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/5021a57d-0601-0010-6097-ec94a09c626d?QuickLink=index&overridelayout=true
    Please note that you should use PCD filter only when there is no other option. Most of the times you can achieve the same result by tweaking your design.
    Also refer to
    Be Careful When Combining Navigation Cache, PCD Filter
    to understand when you shouldn't be using PCD filter.
    Let the community  know your exact requirement and the community should be able to suggest the best approach.
    Thanks
    Prashant

  • How to trace the changes made by other user in portal

    Hi All,
    Actually i have a requirement like, some body has done some changes in Development server how to trace those chnages in portals or Visual Admin (who is the user and what are all the objects that got changed) .
    Actually our development system , Quality and Production systems are working fine till yesterday but when we logon to the dev, qua, prd systems today there are some changes and some of the things are not working client was asking us whether we have done some canges if not who has done the changes.
    Is there any place where all these changes can be recorded (likes who is the user and changes ....) or traced like log files or any thing else
    Can any one help me out in this regard.
    Thanks & Regards,
    Ramesh.

    Hi ,
    As you told some changes identified. so navigate to corresponnding portal obejcts and find modified and last changed by similar properties in the property editor object.
    portal activity reports gives how many users visted specific pcd object but not who visited. You can use pcd filter to compare properties.
    Regards,
    Koti Reddy

  • Role nodes to be made invisible - As per User

    Hi gurus,
    I have created a role with many nodes and sub nodes in it. I want to display say node1, node2 and node3 for one user and node1, node3 for another user. Can I do it with the same role (Invisible in Navigational areas for that role would make it invisible for all the users).
    Is there a way to use the same role and achieve the abovementioned goal.
    rgds,
    Sree

    Yes, You can use PCD filter to achieve this. But this should be your last option as it effects the performance and not intutive for the administrator. You can achieve the same result with Merge ID. which will give you better performance and is easy to maintain.
    Refer to
    Filtering Role Content by User Attributes
    For PCD filter.

  • Topics on EP and the sequence to be followed

    Hi ,
       I have explored a few topics on the development side of the portal and there are a few on my mind .What I wish to know is if I have to develop a team of delivery capability then in what sequence these topics are to be taken with the team . I am listing the topics below . Please guide as I have never been on a project on EP so I am not aware about the importance of these topics and the sequence to be followed while taking them up with a team .
    Iviews : These include
    Making iviews using standard templates available .
    Making iviews using visual composer .
    Making customised iviews using PDK(NDS and WAS) .
    Webdynpro application
    JSPDynpage
    Business Packages
    Integration of Third party applications
    Configuring your mail server with the portal .Learning the configurational concepts of the exchange server .
    BSP applications
    HTMLB and tableviews
    BISDK and XMLA
    Using JCO and JCA
    Knowledge/content management
    Collaboration
    TREX
    If you have some other topics in mind please feel free to include here and also specify where do you wish to include them in the sequence . I need to know how do we go about this as it becomes quite confusing as to what to persue and with what importance as I have never faced a real time client requirements.
    I AM LOOKING FOR AN EXPERT ADVICE HERE .
    Regards
    Deepak Singh

    Hi deepak
    I think you can go for this sequence
    Making iviews(Making iviews using standard templates available .) and other pcd objects like worksets,pages etc..
    Creating users,roles and Assinging  roles to users
    Making iviews using visual composer.
    Knowledge/content management
    Customization of portal.
    Webdynpro application
    JSPDynpage,HTMLB and tableviews
    Making customised iviews using PDK(NDS and WAS).
    Using JCO and JCA
    Creating systems
    Configuring your mail server with the portal.Learning the configurational concepts of the exchange server .
    Integration of Third party applications
    Collaboration
    TREX
    Business Packages
    BSP applications
    BISDK and XMLA
    Regards
    Geogi

Maybe you are looking for