[英]Restful management of Devise model records | Rails 5.2
I'm working on a project that involves two Devise models ( User
and Admin
). 我正在从事一个涉及两个Devise模型( User
和Admin
)的项目。 What I'd like to do is allow for Admin
members to be able to view and manage User
s in a RESTful way (ie: index, show, create, update, destroy). 我想做的是允许Admin
成员能够以RESTful方式(即:索引,显示,创建,更新,销毁)查看和管理User
。
Would the best way be to create a users_controller
and treat it like an average RESTful model (modifying each controller action to work with Devise where applicable)? 最好的方法是创建一个users_controller
并将其视为普通的RESTful模型(在适用的情况下修改每个控制器操作以与Devise一起使用)吗?
Any suggestions would be much appreciated. 任何建议将不胜感激。
Thanks. 谢谢。
CLARIFICATION UPDATE 澄清更新
It seems I wasn't clear about the question above. 似乎我对上述问题不清楚。 Answers below are about the authorisation of actions affecting the User
model. 下面的答案是关于影响User
模型的动作的授权。 This isn't what I'm asking about. 这不是我要问的。 I'm asking about the best way to facilitate the transaction itself, not the authorisation and restriction of the transaction. 我问的是促进交易本身的最佳方法,而不是交易的授权和限制。 What would be the best way to have Admin
members creating User
s and updating User
records without using the standard Devise self-signup. 什么是让Admin
成员创建User
并更新User
记录而不使用标准Devise自注册的最佳方法。 My intention is to disable self-signup so as to only allow new User
registration by an Admin
member creating the User
account. 我的意图是禁用自我注册,以便仅允许创建User
帐户的Admin
成员进行新User
注册。 Hopefully, this is more clear. 希望这更加清楚。 Thanks. 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.