1

ユーザー用と管理者用に別々のページを作成したい。のようだ:

$app->user->checkAccess('uri_my-whatever-access-rights') 

管理者には機能しません。常に true と検証されます。管理者に通常のユーザーと同じオプションを与えたくありません。

これは index.php (Slim) だけでなく、Twig テンプレートにも当てはまります (管理者はすべてのユーザー メニューを見ることができますが、それらはユーザーのみを対象としています)。

バグ?私は何か間違ったことをしていますか?

ありがとう

4

1 に答える 1

1

i noticed the same behavior on my project. The root user always sees everything, a possible fix would be to simply exclude the 'user_master_id' if you not want to see everything as root.

Something like:

if($app->config('user_id_master') == $app->user->id)

should do the job.

Edit: I checked the User.checkAccess(..) Method. See also the API

The User with the MasterUserId will see everything (evaluates always true) any other Admin does not see the stuff which it should not see - like defined in the rule(s).

If you want to exclude the root from some pages/entries simply append a suitable routine like isRoot() to the user model, register it here and you can use it in twig and also in the routing routines.

regards

于 2016-08-01T12:16:26.580 に答える