local test are running
This commit is contained in:
parent
1988b1a30c
commit
b41827e66a
@ -24,9 +24,30 @@
|
|||||||
<class>de.hsadmin.mods.db.Database</class>
|
<class>de.hsadmin.mods.db.Database</class>
|
||||||
<class>de.hsadmin.mods.db.MySqlDatabase</class>
|
<class>de.hsadmin.mods.db.MySqlDatabase</class>
|
||||||
<class>de.hsadmin.mods.db.PgSqlDatabase</class>
|
<class>de.hsadmin.mods.db.PgSqlDatabase</class>
|
||||||
<properties>
|
</persistence-unit>
|
||||||
<property name="openjpa.ConnectionDriverName" value="org.postgresql.Driver"/>
|
<persistence-unit name="hsar">
|
||||||
<property name="openjpa.Compatibility" value="QuotedNumbersInQueries=true"/>
|
<jta-data-source>HsarDataSource</jta-data-source>
|
||||||
</properties>
|
<class>de.hsadmin.core.qserv.QueueTask</class>
|
||||||
|
<class>de.hsadmin.mods.cust.Customer</class>
|
||||||
|
<class>de.hsadmin.mods.cust.Contact</class>
|
||||||
|
<class>de.hsadmin.mods.cust.BankAccount</class>
|
||||||
|
<class>de.hsadmin.mods.pac.Pac</class>
|
||||||
|
<class>de.hsadmin.mods.pac.BasePac</class>
|
||||||
|
<class>de.hsadmin.mods.pac.BaseComponent</class>
|
||||||
|
<class>de.hsadmin.mods.pac.Component</class>
|
||||||
|
<class>de.hsadmin.mods.pac.PacComponent</class>
|
||||||
|
<class>de.hsadmin.mods.pac.Hive</class>
|
||||||
|
<class>de.hsadmin.mods.pac.INetAddress</class>
|
||||||
|
<class>de.hsadmin.mods.user.UnixUser</class>
|
||||||
|
<class>de.hsadmin.mods.dom.Domain</class>
|
||||||
|
<class>de.hsadmin.mods.dom.DomainOption</class>
|
||||||
|
<class>de.hsadmin.mods.email.EMailAddress</class>
|
||||||
|
<class>de.hsadmin.mods.email.EMailAlias</class>
|
||||||
|
<class>de.hsadmin.mods.db.DatabaseUser</class>
|
||||||
|
<class>de.hsadmin.mods.db.MySqlUser</class>
|
||||||
|
<class>de.hsadmin.mods.db.PgSqlUser</class>
|
||||||
|
<class>de.hsadmin.mods.db.Database</class>
|
||||||
|
<class>de.hsadmin.mods.db.MySqlDatabase</class>
|
||||||
|
<class>de.hsadmin.mods.db.PgSqlDatabase</class>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
</persistence>
|
</persistence>
|
||||||
|
BIN
hsarback/lib/enhance/asm-3.2.jar
Normal file
BIN
hsarback/lib/enhance/asm-3.2.jar
Normal file
Binary file not shown.
Binary file not shown.
82
hsarback/src/de/hsadmin/core/model/LoginBean.java
Normal file
82
hsarback/src/de/hsadmin/core/model/LoginBean.java
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
package de.hsadmin.core.model;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.ejb.LocalBean;
|
||||||
|
import javax.ejb.Stateless;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.PersistenceContext;
|
||||||
|
import javax.persistence.Query;
|
||||||
|
|
||||||
|
import de.hsadmin.core.util.Config;
|
||||||
|
import de.hsadmin.mods.cust.Customer;
|
||||||
|
import de.hsadmin.mods.pac.Pac;
|
||||||
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
|
@Stateless(name="LoginBean")
|
||||||
|
@LocalBean
|
||||||
|
public class LoginBean implements LoginBeanLocal {
|
||||||
|
|
||||||
|
@PersistenceContext(unitName="hsar")
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UnixUser login(String user, String ticket) throws AuthenticationException {
|
||||||
|
String ticketUser = TicketValidator.getInstance().validateTicket(ticket);
|
||||||
|
if (user != null && user.equals(ticketUser)) {
|
||||||
|
return readLoginUser(ticketUser); // user himself
|
||||||
|
}
|
||||||
|
if (ticketUser != null && ticketUser.length() == 2) {
|
||||||
|
return readLoginUser(ticketUser); // 2-letter hostmaster
|
||||||
|
}
|
||||||
|
String hostmasterAccountPrefix = Config.getInstance().getProperty("accountprefix.hostmaster", "hsh01") + "-";
|
||||||
|
if (ticketUser != null && ticketUser.startsWith(hostmasterAccountPrefix) && ticketUser.length() == 8) {
|
||||||
|
return readLoginUser(ticketUser); // hsh01 hostmaster
|
||||||
|
}
|
||||||
|
if (ticketUser != null && ticketUser.length() == 5) {
|
||||||
|
Query userQuery = entityManager.createQuery("SELECT u FROM UnixUsers u WHERE u.name = :username");
|
||||||
|
userQuery.setParameter("username", user);
|
||||||
|
UnixUser unixUser = (UnixUser) userQuery.getSingleResult();
|
||||||
|
String pacName = unixUser.getPac().getName();
|
||||||
|
boolean loginOk = ticketUser.equals(pacName);
|
||||||
|
if (loginOk) {
|
||||||
|
return readLoginUser(ticketUser);
|
||||||
|
}
|
||||||
|
throw new AuthenticationException("User " + ticketUser + " is not allowed to run as " + user);
|
||||||
|
}
|
||||||
|
String memberAccountPrefix = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-";
|
||||||
|
if (ticketUser != null && (ticketUser.length() == 3 || (ticketUser.length() >= 9 && ticketUser.startsWith(memberAccountPrefix)))) {
|
||||||
|
Query memberQuery = entityManager.createQuery("SELECT c FROM Customers c WHERE c.name = :membername");
|
||||||
|
memberQuery.setParameter("membername", ticketUser.length() == 3 ? (memberAccountPrefix + ticketUser) : ticketUser);
|
||||||
|
Customer member = (Customer) memberQuery.getSingleResult();
|
||||||
|
Set<Pac> pacs = member.getPacs();
|
||||||
|
for (Pac p : pacs) {
|
||||||
|
if (p.getName().equals(user)) {
|
||||||
|
return readLoginUser(ticketUser); // member as pac-admin
|
||||||
|
}
|
||||||
|
Set<UnixUser> users = p.getUnixUser();
|
||||||
|
for (UnixUser u : users) {
|
||||||
|
if (u.getName().equals(user)) {
|
||||||
|
return readLoginUser(ticketUser); // member as pac-user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new AuthenticationException("User " + ticketUser + " is not allowed to run as " + user);
|
||||||
|
}
|
||||||
|
|
||||||
|
private UnixUser readLoginUser(String loginName) {
|
||||||
|
if (loginName != null && loginName.length() == 2) {
|
||||||
|
loginName = Config.getInstance().getProperty("accountprefix.hostmaster", "hsh01") + "-" + loginName;
|
||||||
|
}
|
||||||
|
if (loginName != null && loginName.length() == 3) {
|
||||||
|
loginName = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-" + loginName;
|
||||||
|
}
|
||||||
|
Query userQuery = entityManager.createQuery("SELECT u FROM UnixUsers u WHERE u.name = :username");
|
||||||
|
userQuery.setParameter("username", loginName);
|
||||||
|
UnixUser user = (UnixUser) userQuery.getSingleResult();
|
||||||
|
user.getPac().getCustomer();
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
hsarback/src/de/hsadmin/core/model/LoginBeanLocal.java
Normal file
12
hsarback/src/de/hsadmin/core/model/LoginBeanLocal.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package de.hsadmin.core.model;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
|
||||||
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
|
@Local
|
||||||
|
public interface LoginBeanLocal {
|
||||||
|
|
||||||
|
public abstract UnixUser login(String user, String ticket) throws AuthenticationException;
|
||||||
|
|
||||||
|
}
|
@ -1,99 +1,29 @@
|
|||||||
package de.hsadmin.core.model;
|
package de.hsadmin.core.model;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.ejb.LocalBean;
|
import javax.ejb.LocalBean;
|
||||||
import javax.ejb.Stateful;
|
import javax.ejb.Stateful;
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
import javax.persistence.PersistenceContextType;
|
|
||||||
import javax.persistence.Query;
|
|
||||||
|
|
||||||
import de.hsadmin.core.util.Config;
|
|
||||||
import de.hsadmin.mods.cust.Customer;
|
|
||||||
import de.hsadmin.mods.pac.Pac;
|
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
@Stateful(name="LoginSession")
|
@Stateful(name="LoginSession")
|
||||||
@LocalBean
|
@LocalBean
|
||||||
public class LoginSession implements LoginSessionLocal {
|
public class LoginSession implements LoginSessionLocal {
|
||||||
|
|
||||||
@PersistenceContext(unitName="hsadmin",type=PersistenceContextType.TRANSACTION)
|
private UnixUser loginUser;
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
private String loginName;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UnixUser getLoginUser() {
|
public UnixUser getLoginUser() {
|
||||||
String loginName = getLoginName();
|
return loginUser;
|
||||||
if (loginName != null && loginName.length() == 2) {
|
|
||||||
loginName = Config.getInstance().getProperty("accountprefix.hostmaster", "hsh01") + "-" + loginName;
|
|
||||||
}
|
|
||||||
if (loginName != null && loginName.length() == 3) {
|
|
||||||
loginName = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-" + loginName;
|
|
||||||
}
|
|
||||||
Query userQuery = entityManager.createQuery("SELECT u FROM UnixUsers u WHERE u.name = :username");
|
|
||||||
userQuery.setParameter("username", loginName);
|
|
||||||
UnixUser unixUser = (UnixUser) userQuery.getSingleResult();
|
|
||||||
return unixUser;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLoginName() {
|
public String getLoginName() {
|
||||||
if (loginName != null) {
|
return loginUser.getName();
|
||||||
return loginName;
|
|
||||||
}
|
|
||||||
throw new TechnicalException("no login");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean login(String user, String ticket) throws AuthenticationException {
|
public void setLoginUser(UnixUser user) {
|
||||||
String ticketUser = TicketValidator.getInstance().validateTicket(ticket);
|
loginUser = user;
|
||||||
if (user != null && user.equals(ticketUser)) {
|
|
||||||
loginName = ticketUser;
|
|
||||||
return true; // user himself
|
|
||||||
}
|
|
||||||
if (ticketUser != null && ticketUser.length() == 2) {
|
|
||||||
loginName = ticketUser;
|
|
||||||
return true; // 2-letter hostmaster
|
|
||||||
}
|
|
||||||
String hostmasterAccountPrefix = Config.getInstance().getProperty("accountprefix.hostmaster", "hsh01") + "-";
|
|
||||||
if (ticketUser != null && ticketUser.startsWith(hostmasterAccountPrefix) && ticketUser.length() == 8) {
|
|
||||||
loginName = ticketUser;
|
|
||||||
return true; // hsh01 hostmaster
|
|
||||||
}
|
|
||||||
if (ticketUser != null && ticketUser.length() == 5) {
|
|
||||||
Query userQuery = entityManager.createQuery("SELECT u FROM UnixUsers u WHERE u.name = :username");
|
|
||||||
userQuery.setParameter("username", user);
|
|
||||||
UnixUser unixUser = (UnixUser) userQuery.getSingleResult();
|
|
||||||
String pacName = unixUser.getPac().getName();
|
|
||||||
boolean loginOk = ticketUser.equals(pacName);
|
|
||||||
if (loginOk) {
|
|
||||||
loginName = ticketUser;
|
|
||||||
}
|
|
||||||
return loginOk; // pac-admin
|
|
||||||
}
|
|
||||||
String memberAccountPrefix = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-";
|
|
||||||
if (ticketUser != null && (ticketUser.length() == 3 || (ticketUser.length() >= 9 && ticketUser.startsWith(memberAccountPrefix)))) {
|
|
||||||
Query memberQuery = entityManager.createQuery("SELECT c FROM Customers c WHERE c.name = :membername");
|
|
||||||
memberQuery.setParameter("membername", ticketUser.length() == 3 ? (memberAccountPrefix + ticketUser) : ticketUser);
|
|
||||||
Customer member = (Customer) memberQuery.getSingleResult();
|
|
||||||
Set<Pac> pacs = member.getPacs();
|
|
||||||
for (Pac p : pacs) {
|
|
||||||
if (p.getName().equals(user)) {
|
|
||||||
loginName = ticketUser;
|
|
||||||
return true; // member as pac-admin
|
|
||||||
}
|
|
||||||
Set<UnixUser> users = p.getUnixUser();
|
|
||||||
for (UnixUser u : users) {
|
|
||||||
if (u.getName().equals(user)) {
|
|
||||||
loginName = ticketUser;
|
|
||||||
return true; // member as pac-user
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new AuthenticationException("User " + ticketUser + " is not allowed to run as " + user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,10 @@ import de.hsadmin.mods.user.UnixUser;
|
|||||||
@Local
|
@Local
|
||||||
public interface LoginSessionLocal {
|
public interface LoginSessionLocal {
|
||||||
|
|
||||||
|
public abstract void setLoginUser(UnixUser user);
|
||||||
|
|
||||||
public abstract UnixUser getLoginUser();
|
public abstract UnixUser getLoginUser();
|
||||||
|
|
||||||
public abstract String getLoginName();
|
public abstract String getLoginName();
|
||||||
|
|
||||||
public abstract boolean login(String user, String ticket)
|
|
||||||
throws AuthenticationException;
|
|
||||||
|
|
||||||
}
|
}
|
@ -20,4 +20,6 @@ public interface Module {
|
|||||||
public AbstractEntity update(LoginSessionLocal session, AbstractEntity existingEntity) throws HSAdminException;
|
public AbstractEntity update(LoginSessionLocal session, AbstractEntity existingEntity) throws HSAdminException;
|
||||||
|
|
||||||
public void delete(LoginSessionLocal session, AbstractEntity existingEntity) throws HSAdminException;
|
public void delete(LoginSessionLocal session, AbstractEntity existingEntity) throws HSAdminException;
|
||||||
|
|
||||||
|
public void detach(AbstractEntity update);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
import javax.ejb.EJB;
|
||||||
|
import javax.ejb.LocalBean;
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
@ -27,10 +28,11 @@ import de.hsadmin.hostsharing.MultiOption;
|
|||||||
import de.hsadmin.mods.pac.Pac;
|
import de.hsadmin.mods.pac.Pac;
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
@Stateless
|
@Stateless(name="EMailAliasModule")
|
||||||
|
@LocalBean
|
||||||
public class EMailAliasModuleImpl implements Module {
|
public class EMailAliasModuleImpl implements Module {
|
||||||
|
|
||||||
@PersistenceContext(name="hsadmin")
|
@PersistenceContext(name="hsar")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@EJB
|
@EJB
|
||||||
|
@ -26,7 +26,7 @@ import de.hsadmin.mods.pac.Pac;
|
|||||||
@Entity(name = "UnixUsers")
|
@Entity(name = "UnixUsers")
|
||||||
@Table(name = "unixuser")
|
@Table(name = "unixuser")
|
||||||
@SequenceGenerator(name = "UnixUsersSeqGen", sequenceName = "unixuser_unixuser_id_seq")
|
@SequenceGenerator(name = "UnixUsersSeqGen", sequenceName = "unixuser_unixuser_id_seq")
|
||||||
@AnnModuleImpl(de.hsadmin.mods.user.UnixUserModuleImpl.class)
|
@AnnModuleImpl(UnixUserModuleImpl.class)
|
||||||
public class UnixUser extends AbstractEntity implements Serializable {
|
public class UnixUser extends AbstractEntity implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7823071611805642906L;
|
private static final long serialVersionUID = 7823071611805642906L;
|
||||||
|
@ -10,27 +10,24 @@ import java.util.Map;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
|
|
||||||
import de.hsadmin.core.model.AbstractEntity;
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
import de.hsadmin.core.model.AuthenticationException;
|
|
||||||
import de.hsadmin.core.model.AuthorisationException;
|
import de.hsadmin.core.model.AuthorisationException;
|
||||||
import de.hsadmin.core.model.HSAdminException;
|
import de.hsadmin.core.model.HSAdminException;
|
||||||
|
import de.hsadmin.core.model.LoginBeanLocal;
|
||||||
import de.hsadmin.core.model.LoginSessionLocal;
|
import de.hsadmin.core.model.LoginSessionLocal;
|
||||||
|
import de.hsadmin.core.model.Module;
|
||||||
import de.hsadmin.mods.email.EMailAlias;
|
import de.hsadmin.mods.email.EMailAlias;
|
||||||
import de.hsadmin.mods.email.EMailAliasModuleImpl;
|
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
public class EMailAliasRemote {
|
public class EMailAliasRemote {
|
||||||
|
|
||||||
@EJB
|
private LoginBeanLocal login;
|
||||||
private LoginSessionLocal session;
|
private LoginSessionLocal session;
|
||||||
|
private Module module;
|
||||||
@EJB
|
|
||||||
private EMailAliasModuleImpl module;
|
|
||||||
|
|
||||||
public EMailAliasRemote() {
|
public EMailAliasRemote() {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
@ -39,7 +36,8 @@ public class EMailAliasRemote {
|
|||||||
try {
|
try {
|
||||||
ctx = new InitialContext(props);
|
ctx = new InitialContext(props);
|
||||||
session = (LoginSessionLocal) ctx.lookup("LoginSessionLocal");
|
session = (LoginSessionLocal) ctx.lookup("LoginSessionLocal");
|
||||||
module = (EMailAliasModuleImpl) ctx.lookup("EMailAliasModuleLocal");
|
login = (LoginBeanLocal) ctx.lookup("LoginBeanLocal");
|
||||||
|
module = (Module) ctx.lookup("EMailAliasModuleLocal");
|
||||||
} catch (NamingException e) {
|
} catch (NamingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -49,7 +47,7 @@ public class EMailAliasRemote {
|
|||||||
Map<String, String> whereParams) throws HSAdminException {
|
Map<String, String> whereParams) throws HSAdminException {
|
||||||
String user = runAsUser;
|
String user = runAsUser;
|
||||||
try {
|
try {
|
||||||
if (session.login(user, ticket)) {
|
session.setLoginUser(login.login(user, ticket));
|
||||||
UnixUser unixUser = session.getLoginUser();
|
UnixUser unixUser = session.getLoginUser();
|
||||||
List<AbstractEntity> list = module.search(session, getEntityClass(),
|
List<AbstractEntity> list = module.search(session, getEntityClass(),
|
||||||
buildQueryCondition(whereParams), null);
|
buildQueryCondition(whereParams), null);
|
||||||
@ -65,9 +63,6 @@ public class EMailAliasRemote {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} else {
|
|
||||||
throw new AuthenticationException("authentication failed");
|
|
||||||
}
|
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
throw new HSAdminException(e);
|
throw new HSAdminException(e);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -79,7 +74,7 @@ public class EMailAliasRemote {
|
|||||||
Map<String, Object> setParams) throws HSAdminException {
|
Map<String, Object> setParams) throws HSAdminException {
|
||||||
String user = runAsUser;
|
String user = runAsUser;
|
||||||
try {
|
try {
|
||||||
if (session.login(user, ticket)) {
|
session.setLoginUser(login.login(user, ticket));
|
||||||
Constructor<? extends AbstractEntity> constructor =
|
Constructor<? extends AbstractEntity> constructor =
|
||||||
getEntityClass().getConstructor();
|
getEntityClass().getConstructor();
|
||||||
AbstractEntity entity = constructor.newInstance();
|
AbstractEntity entity = constructor.newInstance();
|
||||||
@ -89,9 +84,6 @@ public class EMailAliasRemote {
|
|||||||
HashMap<String, Object> entry = new HashMap<String, Object>();
|
HashMap<String, Object> entry = new HashMap<String, Object>();
|
||||||
entity2map(insertedEntity, entry);
|
entity2map(insertedEntity, entry);
|
||||||
return entry;
|
return entry;
|
||||||
} else {
|
|
||||||
throw new AuthenticationException("authentication failed");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new HSAdminException(e);
|
throw new HSAdminException(e);
|
||||||
}
|
}
|
||||||
@ -101,7 +93,7 @@ public class EMailAliasRemote {
|
|||||||
Map<String, String> whereParams) throws HSAdminException {
|
Map<String, String> whereParams) throws HSAdminException {
|
||||||
String user = runAsUser;
|
String user = runAsUser;
|
||||||
try {
|
try {
|
||||||
if (session.login(user, ticket)) {
|
session.setLoginUser(login.login(user, ticket));
|
||||||
UnixUser unixUser = session.getLoginUser();
|
UnixUser unixUser = session.getLoginUser();
|
||||||
String queryCondition = buildQueryCondition(whereParams);
|
String queryCondition = buildQueryCondition(whereParams);
|
||||||
if (queryCondition == null || queryCondition.length() == 0) {
|
if (queryCondition == null || queryCondition.length() == 0) {
|
||||||
@ -117,9 +109,6 @@ public class EMailAliasRemote {
|
|||||||
throw new AuthorisationException(unixUser, "delete", e);
|
throw new AuthorisationException(unixUser, "delete", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new AuthenticationException("authentication failed");
|
|
||||||
}
|
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
throw new HSAdminException(e);
|
throw new HSAdminException(e);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -132,7 +121,7 @@ public class EMailAliasRemote {
|
|||||||
throws HSAdminException {
|
throws HSAdminException {
|
||||||
String user = runAsUser;
|
String user = runAsUser;
|
||||||
try {
|
try {
|
||||||
if (session.login(user, ticket)) {
|
session.setLoginUser(login.login(user, ticket));
|
||||||
UnixUser unixUser = session.getLoginUser();
|
UnixUser unixUser = session.getLoginUser();
|
||||||
ArrayList<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
ArrayList<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||||
String queryCondition = buildQueryCondition(whereParams);
|
String queryCondition = buildQueryCondition(whereParams);
|
||||||
@ -155,9 +144,6 @@ public class EMailAliasRemote {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} else {
|
|
||||||
throw new AuthenticationException("authentication failed");
|
|
||||||
}
|
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
throw new HSAdminException(e);
|
throw new HSAdminException(e);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user