Question

I am working an a task manager web application with xpages.I have a viewpanel that showing assigned tasks of all the employees.The administrator of the application can see all assigned tasks.

However each user of the application (employee) must only see the tasks which are attributed to him .I would like to know how to make visible to the logged in user only the tasks which are attributed to him.Is there another solution different from filtering the view by category(employee category)?

Because this solution will require me to create two viewpanels, one for the administrator and the other one categorized for employees.

Was it helpful?

Solution

In your view panel, there is a "Filter by Category Name", where you can just show the items for the current user. You can obtain the username in SSJS by the Global "session' object. Before using this, you will need to create a categorized view which you might already have.

You could make it so that an administrator sees all categories, or carry on with a different view panel only visible to administrators.

OTHER TIPS

Assuming you have a role for the admin I can think of two approaches.

  1. Would be to create a combo box, hide that combo box unless you are a member of that role, then use the combo box to choose if you want to filter by the username or everything.

  2. Would be to compute the category filter on the view to show everything if you are a member of the admin role and filter by username if you are not.

Category in your view can be multivalue, for example:

Assignee : "*"

Category property of datasource can be computed based on role:

return isAdmin() ? "*" : username;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top