Search in sources :

Example 1 with PersonRoles

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;
}
Also used : Set(java.util.Set) Query(org.hibernate.Query) HibernateException(org.hibernate.HibernateException) PersonRoles(org.mifos.security.util.PersonRoles) SecurityException(org.mifos.framework.exceptions.SecurityException) Session(org.hibernate.Session)

Aggregations

Set (java.util.Set)1 HibernateException (org.hibernate.HibernateException)1 Query (org.hibernate.Query)1 Session (org.hibernate.Session)1 SecurityException (org.mifos.framework.exceptions.SecurityException)1 PersonRoles (org.mifos.security.util.PersonRoles)1