[xwiki-users] Include Macro Bug
Hello, We are currently using the include macro to “include” the content of one page on another page, but have stumbled upon a few problems. The intention of using the include macro was to selectively show content from TestPage1 on TestPage2 only to those users who had read access to TestPage1. For people with no access to TestPage1, the content should be silently dropped without an error message so the viewer without access privileges would not be able to see data from TestPage1 on TestPage2. However in the current implementation, there are a few problems. The include macro seems to work only if the space name is specified, even when the included page is in the same space. If the space name is omitted, only individuals with admin rights are able to view the included page correctly. For everyone else, with appropriate access rights, a “Failed to execute macro: include” error gets produced instead. For example, in our Sandbox space, we tried including TestPage1 into TestPage2 using the following: {{include document="TestPage1"/}} And all the pages under the Sandbox space are viewable by everyone. In this situation, only users with admin rights are able to view the page correctly, while ordinary users see an error message and a stack trace. The stack trace indicates a "Failed to get content for Document" exception. So the ultimate questions are: Is the space name mandatory for the include macro? Is there a technique that allows us to silently produce empty content if the user is not given access rights to that included page (as opposed to seeing an error message)? Are there any other methods of “including” another page without using the include macro? Thank you, Felix Wu
Hi, This is fixed, i will be part of 2.1.2. See http://jira.xwiki.org/jira/browse/XWIKI-4686 for more details. On Wed, Jan 6, 2010 at 19:55, Meng Wu <[email protected]> wrote:
Hello,
We are currently using the include macro to “include” the content of one page on another page, but have stumbled upon a few problems. The intention of using the include macro was to selectively show content from TestPage1 on TestPage2 only to those users who had read access to TestPage1. For people with no access to TestPage1, the content should be silently dropped without an error message so the viewer without access privileges would not be able to see data from TestPage1 on TestPage2. However in the current implementation, there are a few problems.
The include macro seems to work only if the space name is specified, even when the included page is in the same space. If the space name is omitted, only individuals with admin rights are able to view the included page correctly. For everyone else, with appropriate access rights, a “Failed to execute macro: include” error gets produced instead.
For example, in our Sandbox space, we tried including TestPage1 into TestPage2 using the following: {{include document="TestPage1"/}} And all the pages under the Sandbox space are viewable by everyone.
In this situation, only users with admin rights are able to view the page correctly, while ordinary users see an error message and a stack trace. The stack trace indicates a "Failed to get content for Document" exception.
So the ultimate questions are:
Is the space name mandatory for the include macro?
Is there a technique that allows us to silently produce empty content if the user is not given access rights to that included page (as opposed to seeing an error message)?
Are there any other methods of “including” another page without using the include macro?
Thank you,
Felix Wu
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
Hi, Meng Wu wrote:
Hello,
We are currently using the include macro to “include” the content of one page on another page, but have stumbled upon a few problems. The intention of using the include macro was to selectively show content from TestPage1 on TestPage2 only to those users who had read access to TestPage1. For people with no access to TestPage1, the content should be silently dropped without an error message so the viewer without access privileges would not be able to see data from TestPage1 on TestPage2. However in the current implementation, there are a few problems.
The include macro seems to work only if the space name is specified, even when the included page is in the same space. If the space name is omitted, only individuals with admin rights are able to view the included page correctly. For everyone else, with appropriate access rights, a “Failed to execute macro: include” error gets produced instead.
For example, in our Sandbox space, we tried including TestPage1 into TestPage2 using the following: {{include document="TestPage1"/}} And all the pages under the Sandbox space are viewable by everyone.
In this situation, only users with admin rights are able to view the page correctly, while ordinary users see an error message and a stack trace. The stack trace indicates a "Failed to get content for Document" exception.
So the ultimate questions are:
Is the space name mandatory for the include macro?
Is there a technique that allows us to silently produce empty content if the user is not given access rights to that included page (as opposed to seeing an error message)?
See http://tinyurl.com/y9w6u7l . You can test if the current user can view the included page: {{velocity}} #if($xwiki.hasAccessLevel("view", $context.user, "TestPage1")) {{include document="TestPage1"/}} #end {{/velocity}} Hope this helps, Marius
Are there any other methods of “including” another page without using the include macro?
Thank you,
Felix Wu
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (3)
-
Marius Dumitru Florea -
Meng Wu -
Thomas Mortagne