Dashboard > Atlassian Plugins > ... > Macros > user-filter
  Atlassian Plugins Log In | Sign Up   View a printable version of the current page.  
  user-filter

Added by david , last edited by David Peterson on Apr 04, 2008  (view change) show comment
Labels: 

{user-filter}

Plugin: Reporting Plugin, from version 1.0.2

Filters out results based on a user property.

Description

Users can be filtered by a combination of specific user names, group membership and space permissions.

Usage

{user-filter:[key chain]|users=[user list]|groups=[group list]|spaces=[space permissions]}

Parameters

Name Required Default Description
[default]/key
The key chain to apply the filter on. E.g. "content:creator".
users
The list of users to include or exclude. E.g. "+fred, -joe" includes 'fred' but excludes 'joe'. May also be one of the following special values:
  • @self - the current user.
  • @anonymous - no user recorded.
  • @authenticated - any logged in user.
groups
The list of groups to check user membership of. E.g. "confluence-users" will include all registered users.
spaces
The list of space permissions the user must have. E.g. "FOO:edit" requires that the user must have edit permissions on the 'FOO' space. The space key may also be '@self' to indicate that the current space key should be checked. Permissions which can be checked include:
  • edit - the current user can create or edit pages in the space.
  • view - the current user can view pages in the space.
  • admin - the current user can administer the space.
  • news - the current user can create news items.
  • comment - the current user can create a comment.

See Also

Hi David,

I've a table-data "Varianten" with a column "Modell". In this column the user can select from a

{list-data:Modell-Auswahl|required=true}{content-options:spaces=Modell|branches=children}
{list-data}
one Modell such as "C6". In the View-Mode I get C6 with the corresponding link to the C6 page in the Modell space.

The problem is now, that i'm not successful with the following filter search:

{local-reporter:data:Varianten}
{text-filter:map:Modell|include=C6}
{local-reporter}

I think it's because of the internal storage of this value?!

Do you have an idea how to adress these values for filtering?

Thanks a lot!

Robert



Updated by David Peterson
Jan 17, 2008 17:04

Items selected from {list-data} are stored as References, not as the direct object itself. As such, you can use one of the following options, depending on what works best in your scenario:

1. Use text-filter on the referenced page title:

{local-reporter:data:Varianten}
  {text-filter:map:Modell > reference:value > content:title|include=C6}
{local-reporter}

2. Use content-filter on the page:

{local-reporter:data:Varianten}
  {content-filter:map:Modell > reference:value|scope=C6}
{local-reporter}

Thanks, David, for your fast response.

But either the text-filter nor the content-filter works. The text-filter shows nothing and the content-filter throws the exception

Could you please create a bug report for the content-filter problem, with the full exception details (preferably from the server log file). It would be helpful if you could provide the exact wiki markup you're using also.

With regards to the text-filter option, I'm not certain what the issue would be there. Sometimes it helps to put a {report-info} with the keychain ('map:Modell > reference:value > content:title') into your report output to make sure we have the correct keychain in the first place. What data type is 'Varianten'?

View the rest of this thread  |  3 more comments by 2 persons

Oh, boy, am I glad I saw this thread!

The Reference Supplier's page definitely needs an example like this one – as does this page – and possibly also the {list-data} page's, or something.

Again, let me explain in my own words to be sure I understand: {user-filter}'s keychain must evaluate to a User Supplier, which a {list-data} keychain doesn't – it evaluates to a Reference Supplier, whose value member will, if it was selected from a {user-options} list.

Which example did you find useful?

To answer your question, you are close - the values evaluate to a User, which the User Supplier can provide more information about, or a Reference, which the Reference Supplier can provide more information about. But yes, that's the basic idea.

The example posted by the initiator of this thread, which is probably not a good one. The point was that I was trying to filter pages having a particular {list-data} value selected from a {user-options}, and {user-filter} just wasn't buying it, though it worked perfectly with page metadata like content:creator.

This showed me that my problem was that the selected list item wasn't a User, though it rendered fine – presumably through its toString method – instead it was a Reference which, in order to be successfully passed to {user-filter}, needed to be interpreted through its Reference Supplier, whose value member was a User.

I'm having trouble getting a recipe which will show only those users in a particular group. What I have so far is below:

{report-table}

{user-reporter}
  {text-sort:user:groups}
  {user-filter:user|groups=confluence-users}
{user-reporter}

{report-column:title=Full Name}{report-info:user:full name|link=true}{report-column}
{report-column:title=Email}{report-info:user:email|link=true|default=_Unavailable_}{report-column}
{report-column:title=Username}{report-info:user:name}{report-column}
{report-column:title=Groups}{report-info:user:groups|default=_Unavailable_}{report-column}

{report-table}

However, even though there are members of the group confluence-users the report is empty; presumably I'm abusing the user-filter macro somehow?

Thanks in advance for any help.

Hi Simon,

There are a couple of issues. Firstly, you should probably use the 'groups' parameter on the user-reporter itself, rather than adding a user-filter. The user-filter is more for doing reports on other types of data (such as Confluence page creators, etc). Also, I'm not sure what you're trying to accomplish with the text-sort above. As is indicated in the User Supplier documentation, the 'user:groups' value will be a list of user groups, while text-sort expects a text value. Also, since you're limiting the input to one group, it would have no effect anyway.

In any case, try this instead:

{user-reporter:groups=confluence-users}
{user-reporter}

Let me know if you have any trouble.

Copyright(c) CustomWare Asia Pacific Pty Ltd
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators