use of org.mifos.framework.exceptions.SecurityException 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;
}
use of org.mifos.framework.exceptions.SecurityException in project head by mifos.
the class OfficePersistence method getPersonnelOffices.
/**
* This function is used to get the list of the offices under the given
* personnel office under any user at any time
*
* @param officeid
* office id of the person
* @return List list of the offices under him
* @throws HibernateProcessException
*/
public List<OfficeSearch> getPersonnelOffices(Short officeid) throws SystemException, ApplicationException {
HierarchyManager hm = HierarchyManager.getInstance();
String pattern = hm.getSearchId(officeid) + "%";
List<OfficeSearch> lst = null;
try {
Session session = StaticHibernateUtil.getSessionTL();
Query officeSearch = session.getNamedQuery(NamedQueryConstants.GETOFFICESEARCH);
officeSearch.setString(SecurityConstants.PATTERN, pattern);
lst = officeSearch.list();
} catch (HibernateException he) {
throw new SecurityException(SecurityConstants.GENERALERROR, he);
}
return lst;
}
use of org.mifos.framework.exceptions.SecurityException in project head by mifos.
the class OfficePersistence method getOffices.
/**
* This function is used to initialise the the hirerchy manager which is
* paert of the security module which keeps the cache of officeid to office
* search id so that it can find office under given person without going to
* database every time
*
* @return List of OfficeSearch objects which contains office is and
* associated searchid
* @throws HibernateProcessException
*/
public List<OfficeSearch> getOffices() throws SystemException, ApplicationException {
List<OfficeSearch> lst = null;
try {
Session session = StaticHibernateUtil.getSessionTL();
Query queryOfficeSearchList = session.getNamedQuery(NamedQueryConstants.GETOFFICESEARCHLIST);
lst = queryOfficeSearchList.list();
} catch (HibernateException he) {
throw new SecurityException(SecurityConstants.GENERALERROR, he);
}
return lst;
}
Aggregations