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

Fix right way #80

Closed
wants to merge 1 commit into from
Closed

Fix right way #80

wants to merge 1 commit into from

Conversation

gonzaloalonsod
Copy link
Contributor

right way:
http://php.net/manual/en/control-structures.switch.php

$actionName = 'automplete'
error: no break changes $actionName to 'list'

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 90.656% when pulling cfe9868 on gonzakpo:master into 2c3b667 on alterphp:master.

@alterphp
Copy link
Owner

This is the expected behavior, we want autocomplete action to be mapped on list action.

@alterphp alterphp closed this Nov 30, 2018
@gonzaloalonsod
Copy link
Contributor Author

gonzaloalonsod commented Nov 30, 2018

Example role security does not work:

easy_admin:
     entities:
         Entity:
             role: ROLE_SUPER_ADMIN
             list:
                 ...
             autocomplete:
                 role: ROLE_USER

@alterphp
Copy link
Owner

Of course, there is no role for autocomplete, it's mapped on role required for list.

Do you really need different role for autocomplete and list ?

@gonzaloalonsod
Copy link
Contributor Author

gonzaloalonsod commented Nov 30, 2018

By default it takes the entity role, as in the example, but a minor role does not see a select autcomplete in a form.
And I just need autocomplete, not the whole list.
Is better

@alterphp
Copy link
Owner

Autocomplete required role for list as autocomplete basically list items. Give the role required for list and it will work.

@gonzaloalonsod
Copy link
Contributor Author

gonzaloalonsod commented Nov 30, 2018

If

list:
    role: ROLE_USER

Product Form uses autocomplete category and it works.
You can access: (BUG)
http://127.0.0.1:8000/admin/?action=list&entity=Category

If

autocomplete:
    role: ROLE_USER

Product Form uses autocomplete category and it works.
Do not access: (OK)
http://127.0.0.1:8000/admin/?action=list&entity=Category

@alterphp
Copy link
Owner

alterphp commented Nov 30, 2018

So you want the same user cannot access list but is allowed for autocomplete ?

This is not expected by the bundle and changing it is a BC break (existing projects do not define a specific role for autocomplete action as it not considered).

Of course you can override AdminController::isActionAllowed to match your specific needs.

@gonzaloalonsod
Copy link
Contributor Author

If I treat the role 'autocomplete' only if it is defined in the yaml, otherwise I will use it as 'list'.
can be?

@alterphp
Copy link
Owner

It would be the good move, but required changes in the code seems important for a minor improvement (that can easily be obtained by overriding).

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

Successfully merging this pull request may close these issues.

None yet

3 participants