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

You can also define role permissions per entity field in form #55

Closed
wants to merge 3 commits into from
Closed

You can also define role permissions per entity field in form #55

wants to merge 3 commits into from

Conversation

gonzaloalonsod
Copy link
Contributor

You can also define role permissions per entity field in form:

@coveralls
Copy link

coveralls commented Aug 30, 2018

Coverage Status

Coverage decreased (-0.1%) to 92.754% when pulling 739655f on gonzakpo:master into b0386c4 on alterphp:master.

@alterphp
Copy link
Owner

alterphp commented Aug 30, 2018

Hi @gonzakpo ! That's a nice feature, I definitely like it.

Instead of removing fields, I would prefer to disable them (disabled property in symfony forms). They can be seen but not edited if yon don't have the required role. What do you think ?

It can be achieved with a form configurator, like the TypeConfigurator in easyadmin. Inject AdminAuthorozationChecker in the Configurator and add attribute disabled if user is not allowed to edit the field...

@gonzaloalonsod
Copy link
Contributor Author

Hi thanks!

How to rewrite TypeConfigurator?

@alterphp
Copy link
Owner

Don't rewrite it. You can add a UnauthorizedFieldConfigurator service, with tag easyadmin.form.type.configurator. It will be automatically taken in account by EasyAdmin with the tag.

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