小编yng*_*gwi的帖子

如何仅在GraphRepository中获取经过身份验证的用户拥有的数据

我正在尝试使用Spring Data Neo4j,Spring Data Rest和Spring Security 使用Spring Boot(版本1.4.0.M2)创建REST API .域由三种类型的实体组成:

  • 存储用户名/密码的用户实体以及与所有用户拥有的实体的关系:
@NodeEntity
public class User extends Entity {
    @Relationship(type = "OWNS")
    private Set<Activity> activities;
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;
    private String username;
}
Run Code Online (Sandbox Code Playgroud)
  • 由用户创建/拥有的内容实体:
@NodeEntity
public class Activity extends Entity {
    private String name;
    @Relationship(type = "ON", direction = Relationship.INCOMING)
    private Set<Period> periods;
    @Relationship(type = "HAS", direction = Relationship.INCOMING)
    private User user;
}
Run Code Online (Sandbox Code Playgroud)
  • 存储所有用户可访问的日期和时间信息的数据实体
@NodeEntity
public class Period extends Entity {
    @Relationship(type = "HAS")
    private Set<Activity> activities; …
Run Code Online (Sandbox Code Playgroud)

spring-security spring-data-neo4j spring-data-rest

6
推荐指数
1
解决办法
2398
查看次数