Project

General

Profile

« Previous | Next » 

Revision 9690

merge from 2.6 branch: use AuthUtils to get group and equivalent identities rather than manually try to extract groups from subject info (can include incorrect groups for given primary subject). https://github.nceas.ucsb.edu/KNB/arctic-data/issues/163

View differences:

src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
40 40
import java.util.Calendar;
41 41
import java.util.Date;
42 42
import java.util.Hashtable;
43
import java.util.Iterator;
43 44
import java.util.List;
44 45
import java.util.Set;
45 46
import java.util.Timer;
......
1418 1419
    String[] groupnames = null;
1419 1420
    if (session != null ) {
1420 1421
    	username = session.getSubject().getValue();
1421
    	if (session.getSubjectInfo() != null) {
1422
    		List<Group> groupList = session.getSubjectInfo().getGroupList();
1423
    		if (groupList != null) {
1424
    			groupnames = new String[groupList.size()];
1425
    			for (int i = 0; i < groupList.size(); i++ ) {
1426
    				groupnames[i] = groupList.get(i).getSubject().getValue();
1427
    			}
1428
    		}
1422
    	Set<Subject> otherSubjects = AuthUtils.authorizedClientSubjects(session);
1423
    	if (otherSubjects != null) {    		
1424
			groupnames = new String[otherSubjects.size()];
1425
			int i = 0;
1426
			Iterator<Subject> iter = otherSubjects.iterator();
1427
			while (iter.hasNext()) {
1428
				groupnames[i] = iter.next().getValue();
1429
				i++;
1430
			}
1429 1431
    	}
1430 1432
    }
1431 1433
  

Also available in: Unified diff