Hi Guillaume,
Guillaume Lerouge wrote:
if it works let's use it ;-)
Following Vicent advise in another thread I have realized that
Panels.IncludedDocuments could help me to avoid a problem: if I included
Panels.BulletinBoardList in a given column and an user has no access to
any bulletin board, we got an empty panel. Just the title was showed up.
We think users must not get this entry if they have not access to any
bb. I would like to propose the following code to avoid what we consider
a problem. The way I check for granted access to bb is really primitive.
But it works and it is not dangerous at all! It will be great if you or
others could find a more elegant way to get the same result. Thanks!
*****
#set($sql = ", BaseObject as obj where obj.name=doc.fullName and
obj.className='BBCode.BBClass' and obj.name<>'BBCode.BBClassTemplate'
order by doc.date desc")
#set($count = 0)
#foreach($item in $xwiki.searchDocuments($sql))
#if($xwiki.getDocument($item).hasAccessLevel('view', $context.user)
== 'true')
#set($count = $count +1)
#end
#end
#if($count >0 || $showEmptyPanels)
#includeMacros("XWiki.Macros")
#panelheaderc('My Bulletin Boards')
#foreach($item in $xwiki.searchDocuments($sql))
#if($xwiki.getDocument($item).hasAccessLevel('view', $context.user)
== 'true')
#if ($xwiki.getDocument($item).getValue('bbtitle') != "")
* [$xwiki.getDocument($item).display('bbtitle')>$item]
#else
* [$item]
#end
#end
#end
#panelfooter()
#end
*****
The description must be modified accordingly. Perhaps...
*****
This panels lists all the Bulletin Boards an user has view, edit & admin
access to in a given wiki. If an user does not have the right to see a
given Bulletin Board, he / she will not see it in the list. If he / she
has access to none of them, the panel will not show up.
*****
Thanks!
Sorry, I've forgotten that this code uses a XWiki.Macros document
containing a #panelheaderc customized macro. It is just a workaround
until we have not a generalized expanded/collapsed parameter for panels.