简体   繁体   English

如何在Spring Web应用程序中实现共享功能?

[英]How to implement sharing ability in a Spring web app?

Kind of a higher level question here.I've got a web application that is fairly simple. 这里有一个更高级别的问题。我有一个相当简单的Web应用程序。 There are three seperate "objects" in the application. 应用程序中有三个单独的“对象”。 A Filter, an Authorization, and a Job. 过滤器,授权和作业。 Each Job has to have a Filter and an Authorization to run. 每个作业都必须有一个过滤器和一个授权来运行。

Now a user of this application can create any of these objects and they are all linked to that specific user. 现在,此应用程序的用户可以创建任何这些对象,并且它们都链接到该特定用户。 Now however, the requirements state that they'd like to implement sharing. 然而,现在,要求声明他们想要实现共享。 So a user can share their created items with other users. 因此,用户可以与其他用户共享他们创建的项目。 Honestly I'm just not sure of the best method to implement such a feature and am hoping someone can provide some ideas. 老实说,我只是不确定实现这样一个功能的最佳方法,并希望有人可以提供一些想法。

In the DB, each record has a user column that identifies the user who created it. 在DB中,每个记录都有一个用户列,用于标识创建它的用户。 I initially thought of adding a shareUser column, but that wouldn't really work since each record could be shared with multiple users. 我最初想过添加一个shareUser列,但由于每个记录可以与多个用户共享,所以这不会真正起作用。 I'm just not sure the best way to tie these all together. 我只是不确定将这些结合在一起的最佳方法。 Do I need an entirely new table in the DB that link's users to shared records? 在数据库中是否需要一个将用户链接到共享记录的全新表?

Any thoughts on this would be appreciated. 对此的任何想法将不胜感激。 Thank you. 谢谢。

Yes, you do need a new table for each type of record you need to be "owned". 是的,您需要为您需要“拥有”的每种类型的记录创建一个新表。 You should use cross reference tables for this case. 对于这种情况,您应该使用交叉引用表。

something like: 就像是:

userFilter
 - userId
 - filterId

If a user can only share a record they exist, you should have a createdByUserId column on the particular table. 如果用户只能共享它们存在的记录,则应在特定表上具有createdByUserId列。

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

相关问题 如何在Spring Web应用程序中实现文件夹上传? - How to implement folder upload in a Spring web app? Web App-如何在Web应用程序中实施身份验证 - Web App - How to implement an authentication in a web app 如何在Spring Web Service中实现计划任务? - How to Implement Scheduled Task in Spring Web Service? 在Web应用程序Java EE / Spring的一部分上实现自定义安全性/过滤器 - Implement custom security/filters on a part of a web app Java EE/Spring 如何在 GWT Web 应用程序中正确实现 DAO? - How to correctly implement a DAO in a GWT web app? 如何使用Spring Web Mvc实现Logout功能 - How to implement Logout feature using Spring Web Mvc Java Web应用程序,具有插件框架,并能够连接到源以进行更新 - Java web app, with plugin framework and ability to connect to source for updates 如何在Spring Web Service中为不同客户实施数字签名验证? - How to implement digital signature validation in spring web service for different clients? 如何在Spring Boot嵌入式Web服务器中实现速率限制功能 - how to implement rate limiting functionality in spring boot embedded web servers 如何在服务器上创建Spring Web应用 - How to create a Spring web app on a server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM