Revision a784f00f
Added by Katja Luther about 14 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/User.java | ||
---|---|---|
19 | 19 |
import javax.persistence.OneToOne; |
20 | 20 |
import javax.persistence.Table; |
21 | 21 |
import javax.persistence.Transient; |
22 |
|
|
23 | 22 |
import javax.xml.bind.annotation.XmlAccessType; |
24 | 23 |
import javax.xml.bind.annotation.XmlAccessorType; |
25 | 24 |
import javax.xml.bind.annotation.XmlElement; |
... | ... | |
38 | 37 |
import org.hibernate.annotations.NaturalId; |
39 | 38 |
import org.hibernate.envers.Audited; |
40 | 39 |
import org.hibernate.envers.NotAudited; |
40 |
|
|
41 |
|
|
41 | 42 |
import org.hibernate.search.annotations.Field; |
42 | 43 |
import org.hibernate.search.annotations.Index; |
43 | 44 |
import org.hibernate.search.annotations.Indexed; |
44 | 45 |
import org.hibernate.search.annotations.IndexedEmbedded; |
45 |
import org.springframework.security.GrantedAuthority; |
|
46 |
import org.springframework.security.userdetails.UserDetails; |
|
46 |
import org.springframework.security.core.GrantedAuthority;
|
|
47 |
import org.springframework.security.core.userdetails.UserDetails;
|
|
47 | 48 |
|
48 | 49 |
import eu.etaxonomy.cdm.model.agent.Person; |
49 | 50 |
|
... | ... | |
141 | 142 |
|
142 | 143 |
@XmlTransient |
143 | 144 |
@Transient |
144 |
private GrantedAuthority[] authorities;
|
|
145 |
private Set<GrantedAuthority> authorities;
|
|
145 | 146 |
|
146 | 147 |
private void initAuthorities() { |
147 |
Set<GrantedAuthority> allAuthorities = new TreeSet<GrantedAuthority>();
|
|
148 |
allAuthorities.addAll(grantedAuthorities);
|
|
148 |
authorities = new HashSet<GrantedAuthority>();
|
|
149 |
authorities.addAll(grantedAuthorities); |
|
149 | 150 |
for(Group group : groups) { |
150 |
allAuthorities.addAll(group.getGrantedAuthorities());
|
|
151 |
authorities.addAll(group.getGrantedAuthorities()); |
|
151 | 152 |
} |
152 |
|
|
153 |
authorities = allAuthorities.toArray(new GrantedAuthority[allAuthorities.size()]); |
|
154 | 153 |
} |
155 | 154 |
|
156 | 155 |
@Transient |
157 |
public GrantedAuthority[] getAuthorities() {
|
|
156 |
public Set<GrantedAuthority> getAuthorities() {
|
|
158 | 157 |
if(authorities == null) initAuthorities(); |
159 | 158 |
return authorities; |
160 | 159 |
} |
Also available in: Unified diff
merge cate-development2 branch with trunk