1 | |
package org.kuali.student.lum.kim.role.type; |
2 | |
|
3 | |
import java.util.List; |
4 | |
|
5 | |
import org.kuali.rice.kim.bo.Person; |
6 | |
import org.kuali.rice.kim.bo.types.dto.AttributeSet; |
7 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
8 | |
import org.kuali.rice.kim.service.support.impl.KimDerivedRoleTypeServiceBase; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | 0 | public class AffiliationDerivedRoleTypeServiceImpl extends |
15 | |
KimDerivedRoleTypeServiceBase { |
16 | |
|
17 | |
private static final String EMPLOYEE_STATUS_ACTIVE = "A"; |
18 | 0 | private List<String> includedAffiliationTypes = null; |
19 | |
|
20 | |
@Override |
21 | |
public boolean hasApplicationRole(String principalId, |
22 | |
List<String> groupIds, String namespaceCode, String roleName, |
23 | |
AttributeSet qualification) { |
24 | 0 | Person signedOnPerson = KIMServiceLocator.getPersonService().getPerson(principalId); |
25 | |
|
26 | |
|
27 | 0 | for (String affiliationType : includedAffiliationTypes) { |
28 | 0 | if (signedOnPerson.hasAffiliationOfType(affiliationType) && (signedOnPerson.getEmployeeStatusCode().equals(EMPLOYEE_STATUS_ACTIVE))) { |
29 | 0 | return true; |
30 | |
} |
31 | |
} |
32 | 0 | return false; |
33 | |
} |
34 | |
|
35 | |
public List<String> getIncludedAffiliationTypes() { |
36 | 0 | return includedAffiliationTypes; |
37 | |
} |
38 | |
|
39 | |
public void setIncludedAffiliationTypes(List<String> includedAffiliationTypes) { |
40 | 0 | this.includedAffiliationTypes = includedAffiliationTypes; |
41 | 0 | } |
42 | |
|
43 | |
} |