Skip to Content
author's profile photo Former Member
Former Member

Retrieving the logged on user and layout set from a filter

Hello everyone,

I'm trying to retrieve the currently logged on user from a namespace filter, is there any way to do that? I tried some things I read in documents and forums without success. Here's part of my code :

public class TestFilter3 extends AbstractPortalComponent implements INamespaceFilter {

private final INamespaceFilter predecessorFilter;

private IUser user;

TestFilter3(INamespaceFilter predecessorFilter) {

this.predecessorFilter = predecessorFilter;


public void doContent(IPortalComponentRequest request,IPortalComponentResponse response) {


//user = request.getUser();



The method doContent is not called at all, as my message doesn't print in the console. I also tried this :

IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

That doesn't work, but I don't think I'm using it correctly.

Update : It looks like I can get the user by using the getContext() function for my resources, but the getUser() function returns an object of type "". This class doesn't seem to exist anymore, I think it was replaced by the class "".

Also, is there a way for my program to know by which layout set or collection renderer a repository is accessed? What I'm trying to do is filter content differently depending on which layout set is used.

Thanks and best regards.

Message was edited by: Olivier Tremblay-Ross

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jun 07, 2004 at 12:15 PM

    Hi Oliver,

    it seems that there is a logical mistake in this implementation. An implementation of a NamespaceFilter is called by the repository framework, while an extension of an AbstractPortalComponent is called by teh PortalRuntime. Both parts a unlinked from each other and do not exchange data. This means your request object coming from the doContent() method of the AbstractPortalComponent is never filled or even initialized. Therefor your implementation won't work.

    But to provide a solution, just try this 😊)

    Get the resource context from the currently processed resource in the namespace filter and grap the context object out of it:

    IResourceContext ctx = this.predecessorFilter.getCollection().getContext(); user = ctx.getUser();

    This class is deprecated but mandatory for usage if you handle CM content objects (resources or collections).

    Concerning the layout set, you cannot access this parameter out of a filter implementation. I recommend to do a collection renderer implementation for this purpose, better extend the abstract class LightCollectionRenderer:


    Configuration and runtime will be the FlexibleUI environment.

    Further information: ep 6.0 flexible ui in knowledge management.ppt

    Best regards,

    Thilo Brandt

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Thilo,

      Thank you very much for your help! Everything works now. Also, I've found a way to know which Collection Renderer is used to access the resource, which is close enough to what I needed. Here's the code :

      int n = 0;

      while(!ctx.getValues().values().toArray()[n].getClass().getName().endsWith("CustomizingController")) {



      ICustomizingController ctrlCustom = (ICustomizingController) ctx.getValues().values().toArray()[n];

      String collRenderer = ctrlCustom.parameters().getParameter(IFlavorConst.FLAVOR_NULL,IParameterNameConst.COLLECTION_RENDERER_SETTINGS);

      By modifying the IParameterNameConst, it's possible to know the resource renderer, the layout controller, and other properties.

      Thanks again and best regards.

      Message was edited by: Olivier Tremblay-Ross

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.