|
15 | 15 | import org.fenixedu.bennu.core.domain.Bennu; |
16 | 16 | import org.fenixedu.bennu.core.domain.User; |
17 | 17 | import org.fenixedu.bennu.core.domain.UserProfile; |
18 | | -import org.fenixedu.bennu.scheduler.CronTask; |
19 | 18 | import org.fenixedu.bennu.scheduler.annotation.Task; |
20 | | -import org.fenixedu.bennu.scheduler.custom.CustomTask; |
21 | | -import org.fenixedu.bennu.scheduler.custom.ReadCustomTask; |
22 | 19 | import org.fenixedu.connect.domain.Account; |
23 | 20 | import org.fenixedu.connect.domain.ConnectSystem; |
24 | 21 | import org.fenixedu.connect.domain.Identity; |
|
41 | 38 | import pt.ist.fenixedu.contracts.domain.accessControl.ActiveEmployees; |
42 | 39 | import pt.ist.fenixedu.contracts.domain.accessControl.ActiveGrantOwner; |
43 | 40 | import pt.ist.fenixedu.contracts.domain.accessControl.ActiveResearchers; |
| 41 | +import pt.ist.fenixedu.contracts.domain.organizationalStructure.Invitation; |
44 | 42 | import pt.ist.fenixframework.FenixFramework; |
45 | 43 | import pt.ist.standards.geographic.Planet; |
46 | 44 |
|
@@ -276,7 +274,18 @@ private boolean isStudentOrTeacherOrEmployee(final User user) { |
276 | 274 | return true; |
277 | 275 | } |
278 | 276 | } |
279 | | - return new ActiveEmployees().isMember(user) || new ActiveResearchers().isMember(user) || new ActiveGrantOwner().isMember(user); |
| 277 | + return new ActiveEmployees().isMember(user) |
| 278 | + || new ActiveResearchers().isMember(user) |
| 279 | + || new ActiveGrantOwner().isMember(user) |
| 280 | + || hasActiveInvite(user); |
| 281 | + } |
| 282 | + |
| 283 | + private boolean hasActiveInvite(final User user) { |
| 284 | + return user.getPerson() != null && user.getPerson().getParentsSet().stream() |
| 285 | + .filter(Invitation.class::isInstance) |
| 286 | + .map(Invitation.class::cast) |
| 287 | + .anyMatch(invitation -> invitation.isActive()); |
| 288 | + |
280 | 289 | } |
281 | 290 |
|
282 | 291 | private void createAccount(final User user) { |
|
0 commit comments