RSS macro in user macro

Matthew New March 8, 2012

Hello all you guru's... I am trying to embed the RSS macro in a macro that I have created. If a user is part of the admin group, they should see the macro, otherwise they should get an error saying they do not have access. Forgive my lack of skills, and thank you in advance!

## @noparams

#if($userAccessor.hasMembership("confluence-administrators", $action.remoteUser.name))

RSS:

{rss:url=http://ihost3a.engin.umich.edu/iweb-open/servlet/iweb-open/template/rssIUterm.vm?uniqidscript=272&uterm=20123&iuser=true}

#else

You do not have access to this RSS feed.

#end

1 answer

1 accepted

0 votes
Answer accepted
Andrew Frayling
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2012

Hi Matthew,

If you're on Confluence 4.x try this User Macro:

## Macro title: User RSS
## Macro has a body: N
## Body processing: No macro body
## Output: Selected output option
##
## Developed by: Andrew Frayling
## Date created: 10/03/2012
## Installed by: <your name>
## Macro to display an RSS feed to administrators only
## @noparams

#if ($permissionHelper.isConfluenceAdministrator($action.remoteUser))
  <ac:macro ac:name="rss">
    <ac:parameter ac:name="url">http://feeds.bbci.co.uk/news/rss.xml</ac:parameter>
  </ac:macro>
#else
  <strong>You do not have access to this RSS feed.</strong>
#end

Use $action.remoteUser to get the currently logged in user and for permissions there's $permissionHelper which gives you access to http://docs.atlassian.com/atlassian-confluence/latest/com/atlassian/confluence/security/PermissionHelper.html to check for the various permissions a user may or may not have.

If you're on Confluence 3.x the macro is the same, but instead of:

<ac:macro ac:name="rss">
...
</ac:macro>

you use the old style wiki markup:

{rss:url=http://your_rss_feed.com/feed.xml}

Hope that does what you want?

Andrew.

Matthew New March 12, 2012

Andrew, you are the man!!!!! Thank you so much :)

Andrew Frayling
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2012

You're welcome. Glad it was what you wnated.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events