Devise / Rails - 如何只允许管理员为他人创建帐户? [英] Devise/Rails - How to allow only admin to create account for others?
问题描述
我想知道是否有办法可以做到这一点,而不用太多的黑客。事实上,如果Devise已经登录,Devise不允许用户访问注册页面。
感谢您的建议!
您可以尝试 rails_admin 宝石与Devise一起处理任何管理员特定的任务。您需要添加更多代码进行设置,但至少您可以避免在改变与Devise的交互方面对该解决方案进行黑客攻击。
I am using devise as my authentication solution and now i am thinking about authorization. In my project I (the admin) is the only person authorized to create account for others.
I wonder if there is a way to do it without to much hack. In fact, Devise doesn't allow user to access to the signup page if he is already logged in.
Thanks for your advice on it!
You can try the rails_admin gem in conjunction with Devise to handle any admin-specific tasks. You'll need to add more code to set it up, but at least you avoid hacking around the solution in terms of changing your interactions with Devise.
这篇关于Devise / Rails - 如何只允许管理员为他人创建帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!