这些是我的域类:
class Game {
static hasMany = [players: User]
static belongsTo = [owner: User]
}
class User {
static hasMany = [games: Game]
}
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用它们,我会得到它们No owner defined between domain classes.所以我需要设置关系的所有者.添加static belongsTo = Game到User原因Domain classes cannot own each other in a many-to-many relationship.
我能想到的唯一的其他选择是添加static belongsTo = User到Game类,但我已经有一个belongsTo存在.
我该如何建模呢?
我在我的 grails 应用程序中使用了 Spring Security Core 插件,我想添加以下功能:
当用户已经登录时,将不允许用户使用相同的浏览器userName或password完全使用不同的计算机再次登录。
我认为它应该在 Spring Security 核心的某个地方,但不确定。