Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"addRouterAttributesToFormRequest()" does not forward parameter to controller when using "createFormViewBuilder()" #112

Open
cyrille-chene opened this issue Feb 22, 2024 · 3 comments

Comments

@cyrille-chene
Copy link

cyrille-chene commented Feb 22, 2024

Q A
Bug? Yes
New Feature? no
Sulu Version Sulu 2.5
Browser Version Chrome Version 121.0.6167.185

Actual Behavior

When following this example : https://github.com/sulu/sulu-demo/pull/106/files
WebspaceSettingController.php uses request to check for permission with getSecurityContext() and the webspace parameter.
In this case the webspace parameter doesn't exist

Expected Behavior

Webspace parameter should be forwarded from the FromView with the "addRouterAttributesToFormRequest()" method.

Steps to Reproduce

You can follow the example https://github.com/sulu/sulu-demo/pull/106/files.
You should get an error 403 when accessing the tab in admin BO saying : "context 'sulu.webspaces..setting"
Between the 2 dots is supposed to be the webspace key of the webspace selected in the Back Office.

Possible Solutions

It seems to be in the javascript part of Sulu but i did not investigate it more because of a lack of knowledge here

@LCorentinL
Copy link

Hello,

Up for me 👍

@manuxi
Copy link

manuxi commented Mar 29, 2024

I digged a bit but had to take a break. I commented out the security stuff, but it's still not working. In my WebspaceSettingsController $request->query->all() is empty.

/*
 * @Route("/webspace-settings/{id}", methods={"GET"}, name="get_webspace_settings")
 * /
public function getAction(Request $request): Response

routes_admin.yml is as follows

sulu_webspace_settings_api:
    type: annotation
    prefix: /admin/api
    resource: Manuxi\SuluWebspaceSettingsBundle\Controller\Admin\WebspaceSettingsController
    name_prefix: sulu_webspace_settings.
    options:
        expose: true

@manuxi
Copy link

manuxi commented Mar 29, 2024

I made a bunde which is working only with a hardcoded webspace, since I'm not able to determine it - neither in Admin nor Controller.
Parts in code which access the webspace are commented out to make it work. Commenting in crashes the application at the current stage. So: no security, no more than one workspace to get it to run.

I really would like to get this to work. Please review!

https://github.com/manuxi/SuluWebspaceSettingsBundle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants