Rev 1606 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1586 | jmachado | 1 | package pt.estgp.estgweb.filters.filters; |
2 | |||
3 | import pt.estgp.estgweb.domain.CourseImpl; |
||
4 | import pt.estgp.estgweb.domain.QuestionarioReportCursoFile; |
||
5 | import pt.estgp.estgweb.domain.Teacher; |
||
6 | import pt.estgp.estgweb.domain.UserSession; |
||
7 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
||
8 | |||
9 | /** |
||
10 | * @author Jorge Machado |
||
11 | * @date 4/Jun/2008 |
||
12 | * @see pt.estgp.estgweb.filters.filters |
||
13 | */ |
||
1606 | jmachado | 14 | public class ResourceAccessControlQuestionariosReportCursoPrivateFilter extends ResourceAccessControlQuestionariosReportBoardsPedagogicoFilter |
1586 | jmachado | 15 | { |
16 | public boolean canAccessResource(UserSession userSession, 1.5.0/docs/api/java/lang/String.html">String identifier) |
||
17 | { |
||
18 | |||
19 | if(userSession.getUser() != null && userSession.getUser() instanceof Teacher) |
||
20 | { |
||
21 | QuestionarioReportCursoFile q = |
||
22 | DaoFactory.getQuestionarioReportCursoFileDaoImpl().findByRepository(identifier); |
||
23 | |||
24 | CourseImpl course = DaoFactory.getCourseDaoImpl().findCourseByCode(q.getEntityCode()); |
||
25 | |||
1606 | jmachado | 26 | if(q == null) |
27 | { |
||
28 | return false; |
||
29 | } |
||
1586 | jmachado | 30 | //comissao so ve se estiver ativo |
31 | if(q.isActive() && course.isFromCourseCommission(userSession)) |
||
32 | { |
||
33 | return true; |
||
34 | } |
||
35 | //BOARD ve sempre |
||
36 | else if(super.canAccessResource(userSession,identifier)) |
||
37 | { |
||
38 | return true; |
||
39 | } |
||
40 | //BOARD DA ESCOLA SO VE SE ESTIVER ATIVO |
||
41 | else if(q.isActive()) |
||
42 | { |
||
1628 | jmachado | 43 | /*DIRECAO DA ESCOLA SAI |
1586 | jmachado | 44 | if(userSession.getUser().hasRole(Globals.ROLE_BOARD_SCHOOL(course.getInstitutionalCode()))) |
45 | return true; |
||
1628 | jmachado | 46 | */ |
1586 | jmachado | 47 | } |
48 | } |
||
49 | return false; |
||
50 | } |
||
51 | } |