Additional Examples
This section includes additional examples to try, both in XQuery and Server-Side JavaScript, that demonstrate the concealing of elements. Using fn:doc()
instead of a CTS query to retrieve documents, different users will be able to view (or not view) protected elements. Since there is no query involved, query rolesets are not required.
These examples make use of the users and roles set up in the earlier example. (See Example—Element Level Security for details.) The first example shows hierarchies of permissions (top-secret, secret, and unclassified) in a document. The second example shows a slightly different way of protecting content with attributes. The example queries can be done in using XQuery or JavaScript.