@Test(expected = IllegalStateException.class) public void testLifecycleNoConfigurationFetch() { new UserManagerResolver().fetch("usr:Administrator"); }
@Override public Object fetch(Object value) throws IllegalStateException { checkConfig(); if (value instanceof String) { String name = (String) value; boolean userPrefix = name.startsWith(NuxeoPrincipal.PREFIX); boolean groupPrefix = name.startsWith(NuxeoGroup.PREFIX); if (includingUsers && !includingGroups) { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); } if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (!includingUsers && includingGroups) { if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); } return getUserManager().getGroup(name); } else { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); return getUserManager().getGroup(name); } else { if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } NuxeoPrincipal principal = getUserManager().getPrincipal(name, false); if (principal != null) { return principal; } else { return getUserManager().getGroup(name); } } } } return null; }
UserManagerResolver extends AbstractObjectResolver implements ObjectResolver { @Override public Object fetch(Object value) throws IllegalStateException { checkConfig(); if (value instanceof String) { String name = (String) value; boolean userPrefix = name.startsWith(NuxeoPrincipal.PREFIX); boolean groupPrefix = name.startsWith(NuxeoGroup.PREFIX); if (includingUsers && !includingGroups) { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); } if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (!includingUsers && includingGroups) { if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); } return getUserManager().getGroup(name); } else { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); return getUserManager().getGroup(name); } else { if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } NuxeoPrincipal principal = getUserManager().getPrincipal(name, false); if (principal != null) { return principal; } else { return getUserManager().getGroup(name); } } } } return null; } }
UserManagerResolver extends AbstractObjectResolver implements ObjectResolver { @Override public Object fetch(Object value) throws IllegalStateException { checkConfig(); if (value instanceof String) { String name = (String) value; boolean userPrefix = name.startsWith(NuxeoPrincipal.PREFIX); boolean groupPrefix = name.startsWith(NuxeoGroup.PREFIX); if (includingUsers && !includingGroups) { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); } if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (!includingUsers && includingGroups) { if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); } return getUserManager().getGroup(name); } else { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); return getUserManager().getGroup(name); } else { if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } NuxeoPrincipal principal = getUserManager().getPrincipal(name, false); if (principal != null) { return principal; } else { return getUserManager().getGroup(name); } } } } return null; }  }
UserManagerResolver extends AbstractObjectResolver implements ObjectResolver { @Override public Object fetch(Object value) throws IllegalStateException { checkConfig(); if (value instanceof String) { String name = (String) value; boolean userPrefix = name.startsWith(NuxeoPrincipal.PREFIX); boolean groupPrefix = name.startsWith(NuxeoGroup.PREFIX); if (includingUsers && !includingGroups) { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); } if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (!includingUsers && includingGroups) { if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); } return getUserManager().getGroup(name); } else { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); return getUserManager().getGroup(name); } else { if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } NuxeoPrincipal principal = getUserManager().getPrincipal(name, false); if (principal != null) { return principal; } else { return getUserManager().getGroup(name); } } } } return null; }  UserManager getUserManager(); @Override List<Class<?>> getManagedClasses(); @Override void configure(Map<String, String> parameters); @Override String getName(); @Override Object fetch(Object value); @SuppressWarnings("unchecked") @Override T fetch(Class<T> type, Object value); @Override Serializable getReference(Object entity); @Override String getConstraintErrorMessage(Object invalidValue, Locale locale); boolean isIncludingUsers(); boolean isIncludingGroups(); }
UserManagerResolver extends AbstractObjectResolver implements ObjectResolver { @Override public Object fetch(Object value) throws IllegalStateException { checkConfig(); if (value instanceof String) { String name = (String) value; boolean userPrefix = name.startsWith(NuxeoPrincipal.PREFIX); boolean groupPrefix = name.startsWith(NuxeoGroup.PREFIX); if (includingUsers && !includingGroups) { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); } if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (!includingUsers && includingGroups) { if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); } return getUserManager().getGroup(name); } else { if (userPrefix) { name = name.substring(NuxeoPrincipal.PREFIX.length()); if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } return getUserManager().getPrincipal(name, false); } else if (groupPrefix) { name = name.substring(NuxeoGroup.PREFIX.length()); return getUserManager().getGroup(name); } else { if (SecurityConstants.SYSTEM_USERNAME.equals(name)) { return new SystemPrincipal(null); } NuxeoPrincipal principal = getUserManager().getPrincipal(name, false); if (principal != null) { return principal; } else { return getUserManager().getGroup(name); } } } } return null; }  UserManager getUserManager(); @Override List<Class<?>> getManagedClasses(); @Override void configure(Map<String, String> parameters); @Override String getName(); @Override Object fetch(Object value); @SuppressWarnings("unchecked") @Override T fetch(Class<T> type, Object value); @Override Serializable getReference(Object entity); @Override String getConstraintErrorMessage(Object invalidValue, Locale locale); boolean isIncludingUsers(); boolean isIncludingGroups(); static final String INPUT_PARAM_FILTER; static final String FILTER_GROUP; static final String FILTER_USER; static final String NAME; static final String PARAM_INCLUDE_USERS; static final String PARAM_INCLUDE_GROUPS; }