Author: msorokin
Date: 2009-04-13 13:56:33 -0400 (Mon, 13 Apr 2009)
New Revision: 13542
Modified:
trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
Log:
https://jira.jboss.org/jira/browse/RF-6557
rich:isUserInRole(Object) function is documented
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2009-04-13
17:29:53 UTC (rev 13541)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2009-04-13
17:56:33 UTC (rev 13542)
@@ -3766,4 +3766,24 @@
url="http://livedemo.exadel.com/richfaces-demo/richfaces/stateAPI.js...
here</ulink>. </para>
</section>
+
+ <section>
+ <title>Identifing User Roles</title>
+
+ <para>RichFaces provides a function to check whether the logged-in user belongs
to a certain <property>user role</property>. The function is
<code>rich:isUserInRole(Object)</code>, it takes a String, a comma-separated
list String, Collection etc. as arguments and returns a boolean value.
+ </para>
+ <para>For example, you need to render some controls only for administrators.
+ To do this you need to create a role "admin" in web.xml and
implement authorisation that assigns the "admin" role to the user that
loggged-in as an administrator. Afterwards, you can use the
<code>rich:isUserInRole(Object)</code> function with the
<emphasis><property>"rendered"</property></emphasis>
attribute of any component.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<rich:editor value="#{bean.text}"
rendered="#{rich:isUserInRole('admin')}" />
+...]]></programlisting>
+
+ <para>In the example above only a logged-in user with the role
"admin" can see the text editor while for the user with other roles the
component will not be rendered.</para>
+
+ </section>
+
</chapter>