module secure and method controllers.Secure.check(Check)

239 views
Skip to first unread message

Thibault

unread,
Aug 2, 2010, 3:29:36 AM8/2/10
to play-framework
I would like to know why the method returns failed when one of the
profiles failed.

Why the method doesn't return failed when all profiles failed?

When an application haves serveral profiles If don't modify this
method, I should create one action method for each profiles. So, I
change the content of the controllers.Secure.check(Check) method like
this:

private static void check(Check check) throws Throwable {
boolean authorize = false;
for (String profile : check.value()) {
boolean hasProfile = (Boolean) Security.invoke("check", profile);
if (hasProfile) {
authorize = true;
break;
}
}
if (!authorize)
Security.invoke("onCheckFailed");
}

Guillaume Bort

unread,
Aug 2, 2010, 5:10:20 AM8/2/10
to play-fr...@googlegroups.com
Because the default is an AND between all roles. But if you want to
use OR you can easily fork the secure module to build your own. As you
see it is really easy.

The secure module is just a sample module to help to to start. When
you need something more complicated you have to create your own
version.

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>

--
Guillaume Bort, http://guillaume.bort.fr

For anything work-related, use g...@zenexity.fr; for everything else,
write guillau...@gmail.com

Reply all
Reply to author
Forward
0 new messages