简体   繁体   English

如何设置管理员批准模型的编辑

[英]How to setup admin approval a model's edits

I need a system where a regular user can edit a model but the edits don't actually happen until they are approved by an administrator.我需要一个普通用户可以编辑 model 的系统,但在得到管理员批准之前,这些编辑实际上不会发生。 I found a gem called paper_trail that does had model versioning but doesn't support specifically what I want to do.我发现了一个名为paper_trail的 gem,它确实有 model 版本控制,但不具体支持我想做的事情。 I'm wondering how other people have handled this problem.我想知道其他人是如何处理这个问题的。 I should add that there are also associations that I would like to be able for the user to edit at the same time.我应该补充一点,我还希望用户能够同时编辑一些关联。 They aren't very complicated, for example one is aliases.它们不是很复杂,例如一个是别名。

The more complicated part maybe be the case where multiple users edit the same model and trying to do some sort of merge.更复杂的部分可能是多个用户编辑相同的 model 并尝试进行某种合并的情况。

One approach would be to do versioning with version approval.一种方法是在版本批准的情况下进行版本控制。

Every edit creates a new version of the model object and its associations.每次编辑都会创建一个新版本的 model object 及其关联。 At any one time there is only one "current" version of any model object (and it's representation in the database).在任何时候,任何 model object (以及它在数据库中的表示)都只有一个“当前”版本。

If two users submit two separate edits, these would create two "pending" versions.如果两个用户提交两个单独的编辑,这将创建两个“待定”版本。

An admin would approve edits by moving the current version to the new "pending" version.管理员将通过将当前版本移动到新的“待定”版本来批准编辑。 Merges could be accomplished as well, but that could be very domain specific, and could result in conflicts, so keeping separate versions would be smart anyways.合并也可以完成,但这可能是非常特定于域的,并且可能导致冲突,因此保持单独的版本无论如何都是明智的。

There are a few ways to accomplish this, and the best would depend on the dynamics of the situation.有几种方法可以实现这一点,最好的方法取决于情况的动态。

I'd recommend looking at how Git works and trying to model your system after that.我建议您查看 Git 的工作原理,然后尝试 model 您的系统。 Some sort of pointer to your HEAD model object with a revision history and the ability to move HEAD to different revisions.某种指向您的 HEAD model object 的指针,具有修订历史记录和将 HEAD 移动到不同修订的能力。 Merging could also work similar to Git.合并也可以类似于 Git。

Hope that helps.希望有帮助。

I'm looking at this same problem ie approval of revisions, I can came across this , I would suspect you can do something similar with paper_trail .我正在研究同样的问题,即批准修订,我可以遇到这个问题,我怀疑你可以用paper_trail做类似的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 设计管理员用户批准设置 - devise admin user approval setup 在管理员批准后,如何允许发布推文? - How do I allow a tweet to go through after an admin's approval? 如何显示帖子才能显示,因此需要管理员的手动批准? - how to make a post require a manual approval by admin before getting displayed? 如何在使用Doorkeeper时要求手动“管理员”批准OAuth应用程序? - How to require manual 'Admin' approval of an OAuth application when using Doorkeeper? Rails Model 版本控制与批准 - Rails Model Versioning with Approval Active Admin:如何在嵌套模型的 json 列上添加可排序 - Active Admin: how to add sortable on nested model's json column 使用role_model和Factory_Girl(用于规范测试),如何正确设置用户作为管理员? - Using role_model and Factory_Girl (for spec testing), how do I properly setup a user as an admin? Rails:如何使用户能够创建记录,但需要管理员批准才能发布 - Rails: How to enable users to create a record but requires admin approval before posting 如何使用Devise在Rails 3.2中通过Admin进行基于浏览器的新用户批准 - How to do browser-based new user approval by Admin in Rails 3.2 using Devise 需要管理员批准的设计和用户注册 - Devise and user registration requiring admin approval
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM