2013-03-28 17:07:37 +01:00
|
|
|
package com.commafeed.backend.dao;
|
|
|
|
|
|
2013-03-29 12:59:21 +01:00
|
|
|
import java.util.Set;
|
2013-03-28 17:07:37 +01:00
|
|
|
|
|
|
|
|
import javax.ejb.Stateless;
|
|
|
|
|
|
|
|
|
|
import com.commafeed.backend.model.User;
|
|
|
|
|
import com.commafeed.backend.model.UserRole;
|
|
|
|
|
import com.commafeed.frontend.utils.ModelFactory.MF;
|
2013-03-29 12:59:21 +01:00
|
|
|
import com.google.common.collect.Sets;
|
2013-03-28 17:07:37 +01:00
|
|
|
|
|
|
|
|
@SuppressWarnings("serial")
|
|
|
|
|
@Stateless
|
|
|
|
|
public class UserRoleService extends GenericDAO<UserRole, Long> {
|
|
|
|
|
|
2013-03-29 12:59:21 +01:00
|
|
|
public Set<String> getRoles(User user) {
|
|
|
|
|
Set<String> list = Sets.newHashSet();
|
2013-03-28 17:07:37 +01:00
|
|
|
for (UserRole role : findByField(MF.i(proxy().getUser()), user)) {
|
|
|
|
|
list.add(role.getRole());
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
}
|