322c9502
Julien Cartigny
Ad Spring securit...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
package fr.plil.sio.web.mvc;
import org.springframework.security.core.GrantedAuthority;
import javax.persistence.*;
import java.util.Set;
import java.util.TreeSet;
@Entity
@Table(name = "ROLE_T")
public class Role implements GrantedAuthority {
@Id
@Column(name = "ROLE_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "NAME_F")
private String name;
@ManyToMany
@JoinTable(
name = "USER_ROLE_T",
joinColumns = @JoinColumn(name = "ROLE_ID", referencedColumnName = "ROLE_ID"),
inverseJoinColumns = @JoinColumn(name = "USER_ID", referencedColumnName = "USER_ID"))
private Set<User> users = new TreeSet<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<User> getUsers() {
return users;
}
public void setUsers(Set<User> users) {
this.users = users;
}
@Override
public String getAuthority() {
return name;
}
}
|