01: package org.osbl.authorization.logic;
02:
03: import org.osbl.identity.model.Identity;
04: import org.osbl.authorization.model.Profile;
05: import org.hibernate.*;
06: import org.concern.controller.Transactions;
07:
08: import java.util.List;
09:
10: public class DefaultAuthorizationLogic implements AuthorizationLogic {
11: private SessionFactory sessionFactory;
12:
13: public List<Identity> identitiesWithProfile(Profile profile) {
14: Session session = sessionFactory.getCurrentSession();
15: Query query = session
16: .createQuery("select u.general from User u where :profile in elements(u.profiles)");
17: query.setParameter("profile", profile);
18: return (List<Identity>) query.list();
19: }
20:
21: public void setSessionFactory(SessionFactory sessionFactory) {
22: this.sessionFactory = sessionFactory;
23: }
24: }
|