2

I tried this to prevent role doctor, and employee from accessing the page.

@RequiresRoles(value = {"doctor", "employee"})

But now, doctor and employee cannot access the page. However, @RequiresRoles("doctor") works fine. Doctor can only access the page

What went wrong?

I am using tapestry5, tapestry-security(apache shiro).

4

1 に答える 1

6

あなたの質問はやや矛盾しているので、私はあなたの質問が何であるかを完全に理解できるかどうかわかりません. 医師または従業員のいずれかのユーザーがページにアクセスできるようにしたいと思いますか?

のドキュメントから@RequiresRoles:

現在実行中のサブジェクトが、指定されたすべてのロールを持っている必要があります。

(私のものを強調してください。)従業員または医師であるユーザーがページにアクセスできるようにするには、次のように注釈を変更できます。

@RequiresRoles(value = {"doctor", "employee"}, logical = Logical.OR)
于 2011-12-20T13:15:38.913 に答える