[英]Symfony 4 ROLE_USER to ROLE_ADMIN with database
I am learning Symfony 4 and i want to change role of somes users to ROLE_ADMIN. 我正在学习Symfony 4,并且想将某些用户的角色更改为ROLE_ADMIN。
How can do this with a database ? 如何用数据库做到这一点?
I tried to change it manually in database but it doesn't work... 我试图在数据库中手动更改它,但是它不起作用...
(a:1:{i:0;s:9:"ROLE_USER";} -> a:1:{i:0;s:10:"ROLE_ADMIN";}) (a:1:{i:0; s:9:“ ROLE_USER”;}-> a:1:{i:0; s:10:“ ROLE_ADMIN”;})
Thank you ;) 谢谢 ;)
To promote users you can use command lines tools for FosUser: 为了提升用户,您可以使用FosUser的命令行工具:
php bin/console fos:user:promote testuser --super
php bin/console fos:user:promote testuser ROLE_ADMIN
check the doc here: https://symfony.com/doc/current/bundles/FOSUserBundle/command_line_tools.html 在此处检查文档: https : //symfony.com/doc/current/bundles/FOSUserBundle/command_line_tools.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.