public Vo updateVo(PerunSession sess, Vo vo) throws VoNotExistsException, InternalErrorException, PrivilegeException { Utils.notNull(sess, "sess"); vosManagerBl.checkVoExists(sess, vo); // Authorization - Vo admin required if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo)) { throw new PrivilegeException(sess, "updateVo"); } if (vo.getName().length() > 128) { throw new InternalErrorException("VO name is too long, >128 characters"); } if (!vo.getShortName().matches("^[-_a-zA-z0-9.]{1,16}$")) { throw new InternalErrorException( "Wrong VO short name - must matches [-_a-zA-z0-9.]+ and not be longer than 16 characters."); } return vosManagerBl.updateVo(sess, vo); }
public void createVo(Vo vo) throws InternalErrorException { // Create a set of attributes for vo Attributes voAttributes = new BasicAttributes(); // Create the objectclass to add Attribute voObjClasses = new BasicAttribute("objectClass"); voObjClasses.add("top"); voObjClasses.add("organization"); voObjClasses.add("perunVO"); // Add attributes voAttributes.put(voObjClasses); voAttributes.put("o", vo.getShortName()); voAttributes.put("description", vo.getName()); voAttributes.put("perunVoId", String.valueOf(vo.getId())); // Create the entires try { ldapTemplate.bind(getVoDNByVoId(String.valueOf(vo.getId())), null, voAttributes); log.debug("New entry created in LDAP: Vo {}.", vo); } catch (NameNotFoundException e) { throw new InternalErrorException(e); } }
public int compareTo(Vo vo) { if (vo != null) { return this.getName().compareTo(vo.getName()); } return 1; }