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 | 0 | public class AffiliationDerivedRoleTypeServiceImpl extends |
11 | |
KimDerivedRoleTypeServiceBase { |
12 | |
|
13 | |
private static final String EMPLOYEE_STATUS_ACTIVE = "A"; |
14 | 0 | private List<String> includedAffiliationTypes = null; |
15 | |
|
16 | |
@Override |
17 | |
public boolean hasApplicationRole(String principalId, |
18 | |
List<String> groupIds, String namespaceCode, String roleName, |
19 | |
AttributeSet qualification) { |
20 | 0 | Person signedOnPerson = KIMServiceLocator.getPersonService().getPerson(principalId); |
21 | |
|
22 | |
|
23 | 0 | for (String affiliationType : includedAffiliationTypes) { |
24 | 0 | if (signedOnPerson.hasAffiliationOfType(affiliationType) && (signedOnPerson.getEmployeeStatusCode().equals(EMPLOYEE_STATUS_ACTIVE))) { |
25 | 0 | return true; |
26 | |
} |
27 | |
} |
28 | 0 | return false; |
29 | |
} |
30 | |
|
31 | |
public List<String> getIncludedAffiliationTypes() { |
32 | 0 | return includedAffiliationTypes; |
33 | |
} |
34 | |
|
35 | |
public void setIncludedAffiliationTypes(List<String> includedAffiliationTypes) { |
36 | 0 | this.includedAffiliationTypes = includedAffiliationTypes; |
37 | 0 | } |
38 | |
|
39 | |
} |