Restrict

A Restrict constraint allows you to OR role groups together. For example, you could allow access to a user that matches at least one of the following restrictions:

Specification
Result
@@Restrict({@@Group("foo"),
            @@Group("bar")})
public class RestrictController extends Controller
@@Restrict({@@Group({"foo", "bar"})})
public static Result restrictOne() {
    return ok(accessOk.render());
}
@@Restrict({@@Group({"hurdy", "gurdy"}), @@Group("foo")})
public static Result restrictTwo() {
    return ok(accessOk.render());
}
@@Restrict({@@Group("foo"), @@Group("!bar")})
public static Result restrictThree() {
    return ok(accessOk.render());
}
@@Restrict(@@Group({"hurdy", "foo"}))
public static Result restrictFour() {
    return ok(accessOk.render());
}
@@Restrict(@@Group({"foo", "!bar"}))
public static Result restrictFive() {
    return ok(accessOk.render());
}
@@CustomRestrict(value = { @@RoleGroup({MyRoles.foo, MyRoles.bar}),
                          @@RoleGroup(MyRoles.hurdy)},
                config = @@Restrict({}))
public static Result customRestrictOne() {
    return ok(accessOk.render());
}
@@CustomRestrict(value = { @@RoleGroup({MyRoles.hurdy, MyRoles.foo}),
                          @@RoleGroup({MyRoles.hurdy, MyRoles.bar})},
                config = @@Restrict({}))
public static Result customRestrictTwo() {
    return ok(accessOk.render());
}