@import be.objectify.deadbolt.java.views.html._ @import be.objectify.deadbolt.core.utils.TemplateUtils._
restrict uses an ANDed set of roles within an array to determine if a part of a template is rendered. For example, a user with the roles "foo" and "bar" could see a restrict-protected area of template that required any of the following:
However, a restrict that required "foo", "bar" and "hurdy" would not render the protected area.
Giving multiple arrays in the list gives the equivalent of the Restrictions controller action.
As a convenience for creating Array[String] instances, you can use the TemplateUtils#as(String...) method.
This content should be visible
@@restrict(la(as("foo", "bar"))) { This content should be visible }
This content should NOT be visible
@@restrict(la(as("foo", "bar", "hurdy"))) { This content should NOT be visible }
This content should be visible
@@restrict(List(as("hurdy"), as("foo", "bar"))) { This content should be visible }
This content should be visible
@@restrictOr(la(as("foo", "bar"))) { This content should be visible }{Sorry, you're not allowed to see this}
This content should NOT be visible
@@restrictOr(la(as("foo", "bar", "hurdy"))) { This content should NOT be visible }{Sorry, you're not allowed to see this}