Restricting/Hiding Content

Good day!

For what I’m trying to do the ideal solution would be if I could make parts of pages visible only if you are an admin.
I understand that may not be possible, but I can’t even manage to make the whole page inaccessible to unregistered users. I tried playing with the rights and blocking access to XWikiAllGroup, but that doesn’t seem to do anything.
Is the first thing I mentioned even possible and what am I doing wrong in blocking some pages for unregistered users?

Thank you!

Only setting VIEW right is not always enough actually. You should also make sure the user does not have EDIT (or ADMIN) right since it would automatically give it VIEW right.

For you other question yes it’s possible out of the box with scripting but you might want to take a look at

Yeah, that definitely helped, works as intended now.

That extension seems like exactly what I need, but when I installed it no matter what I do I shows as “Unknown macro: condition.”.
But the first answer already helped a bunch, thanks!

How about displaying content if the user is not logged in?

For example, I’ll make the entire wiki unaccessible to non logged in users, but the home page viewable.

However, for those non logged in users, I’d like to conditionally display a bit “LOGIN” link at the top of the page that does not appear after the user logs in.

Would I have to run that as a velocity macro?

Nevermind, that was easy using the velocity scripting.

#if ($isGuest)
  ## This link will only be visible to users that have admin rights on this document
  You will need to [[**LOGIN**>>https://server/xwiki/bin/login/XWiki/XWikiLogin]] to access the full wiki
  Welcome $xcontext.getUser()

That’ll do for now.