jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
613 stars 122 forks source link

Access to menu folders is not granted for anonymous role #690

Closed oshiryaeva closed 2 years ago

oshiryaeva commented 2 years ago

Jmix version: 1.2.2

Here are the steps to grant access to a screen for an anonymous role: https://forum.jmix.io/t/how-can-i-verify-and-use-the-anonymous-user-functionality/938/3 The screen is available without login, but the menu is not available despite the explicit permission:

    @ScreenPolicy(screenIds = {"MyAnonymousScreen"})
    @MenuPolicy(menuIds = {"MyAnonymousScreen"})
    void screens();

Demo project: jmix-anonymous-screen-sample.zip

See also: https://github.com/jmix-projects/jmix-security/issues/52

gorbunkov commented 2 years ago

Did you mean that the left panel with menu items, logout button, etc. is not displayed when MyAnonymousScreen is opened for anonymous user? If so then there is no bug here. This left panel is displayed by the MainScreen, that is opened after the login is completed.

oshiryaeva commented 2 years ago

Exactly. Is there a way to make multiple screens available anonymously (and, consequently, display a menu for them)?

P.S. Smells like a feature request: anonymous access with menu and Login button.

A quarta, 11/05/2022, 18:51, Maxim Gorbunkov @.***> escreveu:

Did you mean that the left panel with menu items, logout button, etc. is not displayed when MyAnonymousScreen is opened for anonymous user? If so then there is no bug here. This left panel is displayed by the MainScreen, that is opened after the login is completed.

— Reply to this email directly, view it on GitHub https://github.com/jmix-framework/jmix/issues/690#issuecomment-1123881225, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWDYVNNL4LVMO4CSEUHKLLVJPCPFANCNFSM5ULBFMZA . You are receiving this because you authored the thread.Message ID: @.***>

gorbunkov commented 2 years ago

In this case your anonymous screen must be created using the "Main screen with side menu" template. Such template contains menu, working area, etc. Keep in mind that you'll have two main screens in your app. The default one will be used for authenticated users and the anonymous one for anonymous:

jmix.ui.main-screen-id = MainScreen
jmix.ui.initial-screen-id=AnonymousMainScreen
oshiryaeva commented 2 years ago

Thank you for comprehensive explanation. Not a bug, so.