core/src/main/java/org/sakaiproject/nakamura/api/lite/authorizable/User.java
public boolean allowImpersonate(Subject impersSubject) {

        String impersonators = (String) getProperty(IMPERSONATORS_FIELD);
        if (impersonators == null) {
            return false;
        }
        Set<String> impersonatorSet = ImmutableSet.copyOf(StringUtils.split(impersonators, ';'));
        for (Principal p : impersSubject.getPrincipals()) {

            if (ADMIN_USER.equals(p.getName()) || SYSTEM_USER.equals(p.getName())
                    || impersonatorSet.contains(p.getName())) {
                return true;
            }
        }
        return false;
    }
public boolean allowImpersonate(Subject impersSubject) {

        String impersonators = (String) getProperty(IMPERSONATORS_FIELD);
        if (impersonators == null) {
            return false;
        }
        Set<String> impersonatorSet = ImmutableSet.copyOf(StringUtils.split(impersonators, ';'));
        for (Principal p : impersSubject.getPrincipals()) {

            if (ADMIN_USER.equals(p.getName()) || SYSTEM_USER.equals(p.getName())
                    || impersonatorSet.contains(p.getName())) {
                return true;
            }
        }
        return false;
    }
public boolean allowImpersonate ( Subject impersSubject ) { String impersonators = ( String ) getProperty ( IMPERSONATORS_FIELD ) ; if ( impersonators == null ) { return false ; } Set < String > impersonatorSet = ImmutableSet . copyOf ( StringUtils . split ( impersonators , ' ' ) ) ; for ( Principal p : impersSubject . getPrincipals ( ) ) { if ( ADMIN_USER . equals ( p . getName ( ) ) || SYSTEM_USER . equals ( p . getName ( ) ) || impersonatorSet . contains ( p . getName ( ) ) ) { return true ; } } return false ; }
TODO: Unit test
TODO : Unit test