| | |
| | | } |
| | | |
| | | @Override |
| | | public AbstractEntity add(AbstractEntity newEntity) throws HSAdminException { |
| | | MySqlDatabase database = (MySqlDatabase) newEntity; |
| | | String name = database.getName(); |
| | | String pacname = database.getPac().getName(); |
| | | if (!name.startsWith(pacname) || name.length() < 7) { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | if (name.charAt(5) != '_') { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | return super.add(newEntity); |
| | | } |
| | | |
| | | @Override |
| | | public AbstractEntity update(AbstractEntity existingEntity) throws HSAdminException { |
| | | EntityManager em = getTransaction().getEntityManager(); |
| | | UnixUser unixUser = getLoginUser(); |
| | |
| | | @Override |
| | | public AbstractEntity add(AbstractEntity newEntity) throws HSAdminException { |
| | | MySqlUser user = (MySqlUser) newEntity; |
| | | if (user.getName().length() > 16) { |
| | | String name = user.getName(); |
| | | if (name.length() > 16) { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | String pacname = user.getPac().getName(); |
| | | if (!name.startsWith(pacname) || name.length() < 7) { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | if (name.charAt(5) != '_') { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | return super.add(newEntity); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AbstractEntity add(AbstractEntity newEntity) throws HSAdminException { |
| | | PgSqlDatabase database = (PgSqlDatabase) newEntity; |
| | | String name = database.getName(); |
| | | String pacname = database.getPac().getName(); |
| | | if (!name.startsWith(pacname) || name.length() < 7) { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | if (name.charAt(5) != '_') { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | return super.add(newEntity); |
| | | } |
| | | |
| | | @Override |
| | | public AbstractEntity update(AbstractEntity existingEntity) throws HSAdminException { |
| | | EntityManager em = getTransaction().getEntityManager(); |
| | | UnixUser unixUser = getLoginUser(); |
| | |
| | | |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | | import de.hsadmin.core.model.AbstractModuleImpl; |
| | | import de.hsadmin.core.model.AuthorisationException; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | |
| | | public class PgSqlUserModuleImpl extends AbstractModuleImpl { |
| | | |
| | | @Override |
| | | public AbstractEntity add(AbstractEntity newEntity) throws HSAdminException { |
| | | PgSqlUser user = (PgSqlUser) newEntity; |
| | | String name = user.getName(); |
| | | String pacname = user.getPac().getName(); |
| | | if (!name.startsWith(pacname) || name.length() < 7) { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | if (name.charAt(5) != '_') { |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | return super.add(newEntity); |
| | | } |
| | | |
| | | @Override |
| | | public List<AbstractEntity> search(Class<? extends AbstractEntity> entityClass, |
| | | String condition, String orderBy) throws HSAdminException { |
| | | if (orderBy == null || orderBy.length() == 0) { |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import de.hsadmin.core.model.AbstractModuleImpl; |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | | import de.hsadmin.core.model.AuthenticationException; |
| | | import de.hsadmin.core.model.AbstractModuleImpl; |
| | | import de.hsadmin.core.model.AuthorisationException; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | |
| | | public class EMailAliasModuleImpl extends AbstractModuleImpl { |
| | |
| | | String name = alias.getName(); |
| | | String pacname = alias.getPac().getName(); |
| | | if (!name.startsWith(pacname)) { |
| | | throw new AuthenticationException("alias not allowed"); |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | if (name.length() > 5 && (name.charAt(5) != '-') || name.length() == 6) { |
| | | throw new AuthenticationException("alias not allowed"); |
| | | throw new AuthorisationException(getLoginUser(), "add", newEntity); |
| | | } |
| | | return super.add(newEntity); |
| | | } |