private EPersonService getePersonService() { if (ePersonService == null) { ePersonService = EPersonServiceFactory.getInstance().getEPersonService(); } return ePersonService; }
/** * constructor, which just creates and object with a ready context * * @throws Exception if error */ protected CreateAdministrator() throws Exception { context = new Context(); groupService = EPersonServiceFactory.getInstance().getGroupService(); ePersonService = EPersonServiceFactory.getInstance().getEPersonService(); }
/** * Get an array of all of the special groups that current user is a member * of. * * @return list of groups * @throws SQLException if database error */ public List<Group> getSpecialGroups() throws SQLException { List<Group> myGroups = new ArrayList<Group>(); for (UUID groupId : specialGroups) { myGroups.add(EPersonServiceFactory.getInstance().getGroupService().find(this, groupId)); } return myGroups; }
.getAuthorities(); for (SimpleGrantedAuthority grantedAuthority : specialGroups) { context.setSpecialGroup(EPersonServiceFactory.getInstance().getGroupService() .findByName(context, grantedAuthority.getAuthority()) .getID()); EPersonServiceFactory.getInstance().getEPersonService().findByEmail(context, authentication.getName()));
/** * Initialize an IP authenticator, reading in the configuration. Note this * will never fail if the configuration is bad -- a warning will be logged. */ public IPAuthentication() { ipMatchers = new ArrayList<IPMatcher>(); ipNegativeMatchers = new ArrayList<IPMatcher>(); ipMatcherGroupIDs = new HashMap<>(); ipMatcherGroupNames = new HashMap<>(); groupService = EPersonServiceFactory.getInstance().getGroupService(); clientInfoService = CoreServiceFactory.getInstance().getClientInfoService(); List<String> propNames = DSpaceServicesFactory.getInstance().getConfigurationService() .getPropertyKeys("authentication-ip"); for (String propName : propNames) { String[] nameParts = propName.split("\\."); if (nameParts.length == 2) { addMatchers(nameParts[1], DSpaceServicesFactory.getInstance().getConfigurationService().getArrayProperty(propName)); } else { log.warn("Malformed configuration property name: " + propName); } } }
if (context.getCurrentUser() != null && StringUtils.isNotBlank( EPersonServiceFactory.getInstance().getEPersonService().getPasswordHash(context.getCurrentUser()) .toString())) { String groupName = DSpaceServicesFactory.getInstance().getConfigurationService() .getProperty("authentication-password.login.specialgroup"); if ((groupName != null) && (!groupName.trim().equals(""))) { Group specialGroup = EPersonServiceFactory.getInstance().getGroupService() .findByName(context, groupName); if (specialGroup == null) {
String e = line.getOptionValue('e'); if (e.indexOf('@') != -1) { eperson = EPersonServiceFactory.getInstance().getEPersonService().findByEmail(c, e); } else { eperson = EPersonServiceFactory.getInstance().getEPersonService().find(c, UUID.fromString(e));
ctx.turnOffAuthorisationSystem(); EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
public HarvestScheduler() throws SQLException, AuthorizeException { mainContext = new Context(); String harvestAdminParam = ConfigurationManager.getProperty("oai", "harvester.eperson"); harvestAdmin = null; if (harvestAdminParam != null && harvestAdminParam.length() > 0) { harvestAdmin = EPersonServiceFactory.getInstance().getEPersonService() .findByEmail(mainContext, harvestAdminParam); } harvestThreads = new Stack<HarvestThread>(); maxActiveThreads = ConfigurationManager.getIntProperty("oai", "harvester.maxThreads"); if (maxActiveThreads == 0) { maxActiveThreads = 3; } minHeartbeat = ConfigurationManager.getIntProperty("oai", "harvester.minHeartbeat") * 1000; if (minHeartbeat == 0) { minHeartbeat = 30000; } maxHeartbeat = ConfigurationManager.getIntProperty("oai", "harvester.maxHeartbeat") * 1000; if (maxHeartbeat == 0) { maxHeartbeat = 3600000; } }
List<Group> groupList = EPersonServiceFactory.getInstance().getGroupService() .allMemberGroups(context, context.getCurrentUser());
EPerson eperson = null; log.info(LogManager.getHeader(context, "authenticate", "attempting password auth of user=" + username)); eperson = EPersonServiceFactory.getInstance().getEPersonService() .findByEmail(context, username.toLowerCase()); "certificate.")); return CERT_REQUIRED; } else if (EPersonServiceFactory.getInstance().getEPersonService() .checkPassword(context, eperson, password)) {
System.exit(1); EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
myEPerson = EPersonServiceFactory.getInstance().getEPersonService().findByEmail(context, eperson); if (myEPerson == null) { usageError("Error, eperson cannot be found: " + eperson);
EPerson eperson = EPersonServiceFactory.getInstance().getEPersonService().findByEmail(context, user); int epersonId = 0; if (eperson != null) {
/** * add an anonymous group permission policy to the collection for this * action */ private static void addAnonymousPolicy(Context c, DSpaceObject t, int myaction) throws SQLException, AuthorizeException { // group 0 is the anonymous group! Group anonymousGroup = EPersonServiceFactory.getInstance().getGroupService().findByName(c, Group.ANONYMOUS); // now create the default policies for submitted items ResourcePolicyService resourcePolicyService = AuthorizeServiceFactory.getInstance().getResourcePolicyService(); ResourcePolicy myPolicy = resourcePolicyService.create(c); myPolicy.setdSpaceObject(t); myPolicy.setAction(myaction); myPolicy.setGroup(anonymousGroup); resourcePolicyService.update(c, myPolicy); } }
@Override public void initDefaultGroupNames(Context context) throws SQLException, AuthorizeException { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); // Check for Anonymous group. If not found, create it Group anonymousGroup = groupService.findByName(context, Group.ANONYMOUS); if (anonymousGroup == null) { anonymousGroup = groupService.create(context); anonymousGroup.setName(Group.ANONYMOUS); anonymousGroup.setPermanent(true); groupService.update(context, anonymousGroup); } // Check for Administrator group. If not found, create it Group adminGroup = groupService.findByName(context, Group.ADMIN); if (adminGroup == null) { adminGroup = groupService.create(context); adminGroup.setName(Group.ADMIN); adminGroup.setPermanent(true); groupService.update(context, adminGroup); } }
EPersonServiceFactory.getInstance() .getGroupService() .findByName(context, Group.ANONYMOUS),
EPersonServiceFactory.getInstance().getEPersonService();
EPersonServiceFactory.getInstance().getEPersonService();