private Iterable<String> getAllSuperNames() throws ObjectStoreException { Set<String> names = new HashSet<String>(); UserProfile example = new UserProfile(); example.setSuperuser(true); for (UserProfile up: uosw.getObjectsByExample(example, singleton("superuser"))) { names.add(up.getUsername()); } return names; }
private Iterable<String> getAllSuperNames() throws ObjectStoreException { Set<String> names = new HashSet<String>(); UserProfile example = new UserProfile(); example.setSuperuser(true); for (UserProfile up: uosw.getObjectsByExample(example, singleton("superuser"))) { names.add(up.getUsername()); } return names; }
/** * Set the superuser flag and store it in userprofile database * @param isSuperUser if true the profile is set as superuser * @throws ObjectStoreException if an error occurs during storage of the object */ public void setSuperuser(boolean isSuperUser) throws ObjectStoreException { ObjectStoreWriter uosw = manager.getProfileObjectStoreWriter(); UserProfile p = (UserProfile) uosw.getObjectStore().getObjectById(userId, UserProfile.class); p.setSuperuser(isSuperUser); uosw.store(p); this.isSuperUser = isSuperUser; }
/** * Set the superuser flag and store it in userprofile database * @param isSuperUser if true the profile is set as superuser * @throws ObjectStoreException if an error occurs during storage of the object */ public void setSuperuser(boolean isSuperUser) throws ObjectStoreException { ObjectStoreWriter uosw = manager.getProfileObjectStoreWriter(); UserProfile p = (UserProfile) uosw.getObjectStore().getObjectById(userId, UserProfile.class); p.setSuperuser(isSuperUser); uosw.store(p); this.isSuperUser = isSuperUser; }
/** * Creates a profile in the userprofile database without adding bag. * Method used by the ProfileReadXml. * * @param profile a Profile object */ public synchronized void createProfileWithoutBags(Profile profile) { UserProfile userProfile = new UserProfile(); userProfile.setUsername(profile.getUsername()); if (profile.getPassword() != null) { userProfile.setPassword(PasswordHasher.hashPassword(profile.getPassword())); } userProfile.setSuperuser(profile.isSuperUser); try { uosw.store(userProfile); profile.setUserId(userProfile.getId()); } catch (ObjectStoreException e) { throw new RuntimeException(e); } saveProfile(profile); }
/** * Creates a profile in the userprofile database without adding bag. * Method used by the ProfileReadXml. * * @param profile a Profile object */ public synchronized void createProfileWithoutBags(Profile profile) { UserProfile userProfile = new UserProfile(); userProfile.setUsername(profile.getUsername()); if (profile.getPassword() != null) { userProfile.setPassword(PasswordHasher.hashPassword(profile.getPassword())); } userProfile.setSuperuser(profile.isSuperUser); try { uosw.store(userProfile); profile.setUserId(userProfile.getId()); } catch (ObjectStoreException e) { throw new RuntimeException(e); } saveProfile(profile); }
/** * Creates a profile in the userprofile database. * * @param profile a Profile object */ public synchronized void createProfile(Profile profile) { UserProfile userProfile = new UserProfile(); userProfile.setUsername(profile.getUsername()); userProfile.setLocalAccount(profile.isLocal()); if (profile.isLocal() && profile.getPassword() != null) { userProfile.setPassword(PasswordHasher.hashPassword(profile.getPassword())); } userProfile.setSuperuser(profile.isSuperUser); try { uosw.store(userProfile); profile.setUserId(userProfile.getId()); for (InterMineBag bag : profile.getSavedBags().values()) { bag.setProfileId(userProfile.getId()); } } catch (ObjectStoreException e) { throw new RuntimeException(e); } saveProfile(profile); }
/** * Creates a profile in the userprofile database. * * @param profile a Profile object */ public synchronized void createProfile(Profile profile) { UserProfile userProfile = new UserProfile(); userProfile.setUsername(profile.getUsername()); userProfile.setLocalAccount(profile.isLocal()); if (profile.isLocal() && profile.getPassword() != null) { userProfile.setPassword(PasswordHasher.hashPassword(profile.getPassword())); } userProfile.setSuperuser(profile.isSuperUser); try { uosw.store(userProfile); profile.setUserId(userProfile.getId()); for (InterMineBag bag : profile.getSavedBags().values()) { bag.setProfileId(userProfile.getId()); } } catch (ObjectStoreException e) { throw new RuntimeException(e); } saveProfile(profile); }