@RolesAllowed("user") @Deprecated public <T extends IObject> T getEnumeration(Class<T> klass, String value) { return iQuery.findByString(klass, "value", value); }
@RolesAllowed("user") public <T extends IEnum> T getEnumeration(Class<T> k, String string) { IEnum e = iQuery.findByString(k, "value", string); iQuery.initialize(e); if (e == null) { throw new ApiUsageException(String.format( "An %s enum does not exist with the value: %s", k.getName(), string)); } return k.cast(e); }
@RolesAllowed("user") public Experimenter userProxy(final String omeName) { if (omeName == null) { throw new ApiUsageException("omeName argument cannot be null."); } Experimenter e = iQuery.findByString(Experimenter.class, "omeName", roleProvider.isIgnoreCaseLookup() ? omeName.toLowerCase() : omeName); if (e == null) { throw new ApiUsageException("No such experimenter: " + omeName); } return e; }
@RolesAllowed("user") public ExperimenterGroup groupProxy(final String groupName) { if (groupName == null) { throw new ApiUsageException("groupName argument cannot be null."); } ExperimenterGroup g = iQuery.findByString(ExperimenterGroup.class, "name", groupName); if (g == null) { throw new ApiUsageException("No such group: " + groupName); } return g; }
Experimenter omeExp = iQuery.findByString(Experimenter.class, "omeName", username); Experimenter ldapExp = findExperimenter(username);
username = username.toLowerCase(); if (iQuery.findByString(Experimenter.class, "omeName", username) != null) { throw new ValidationException("User already exists: " + username);
public void runAsAdmin() { Experimenter e = iQuery.findByString(Experimenter.class, "omeName", name); if (e == null) { throw new AuthenticationException("Unknown user."); } else if (e.getEmail() == null) { throw new AuthenticationException( "User has no email address."); } else if (!e.getEmail().equals(email)) { throw new AuthenticationException( "Email address does not match."); } else if (passwordUtil.getDnById(e.getId())) { throw new AuthenticationException( "User is authenticated by LDAP server you cannot reset this password."); } else { final long systemGroupId = getSecurityRoles().getSystemGroupId(); for (final ExperimenterGroup group : e.linkedExperimenterGroupList()) { if (group.getId() == systemGroupId) { throw new ApiUsageException( "Cannot reset password of administrators. Have another administrator set the new password."); } } String passwd = passwordUtil.generateRandomPasswd(); sendEmail(e, passwd); // changeUserPassword checks adminOrPiOfUser // Skipping that. See #7327 _changePassword(e.getOmeName(), passwd); } } });