use of org.mifos.security.util.PersonRoles in project head by mifos.
the class LegacyRolesPermissionsDao method getUserRoles.
/**
* This function returns the PersonRoles object which contains the person
* information and the set of all the roles related to that user
*
* @param uid
* user id
* @return PersonRoles
* @throws HibernateProcessException
*/
public Set getUserRoles(short uid) throws SystemException, ApplicationException {
Set roles = null;
try {
Session session = StaticHibernateUtil.getSessionTL();
Query personRoles = session.getNamedQuery(NamedQueryConstants.GETPERSONROLES);
personRoles.setShort("ID", uid);
List<PersonRoles> lst = personRoles.list();
if (null != lst && lst.size() > 0) {
PersonRoles pr = lst.get(0);
roles = pr.getRoles();
}
} catch (HibernateException he) {
throw new SecurityException(SecurityConstants.GENERALERROR, he);
}
return roles;
}
Aggregations