try {
log.warn("loginUser: " + SID + " " + usernameOrEmail);
RoomClient currentClient;
IConnection current = Red5.getConnectionLocal();
Object o;
if (withLdap) {
log.debug("Ldap Login");
currentClient = this.clientListManager
.getClientByStreamId(current.getClient().getId());
// LDAP Loggedin Users cannot use the permanent Login Flag
LdapConfig ldapConfig = LdapConfigDaoImpl.getInstance()
.getLdapConfigById(ldapConfigId);
String ldapLogin = usernameOrEmail;
if (ldapConfig.getAddDomainToUserName() != null
&& ldapConfig.getAddDomainToUserName()) {
ldapLogin = usernameOrEmail + "@" + ldapConfig.getDomain();
}
o = LdapLoginManagement.getInstance().doLdapLogin(ldapLogin,
Userpass, currentClient, SID,
ldapConfig.getConfigFileName());
} else {
currentClient = this.clientListManager
.getClientByStreamId(current.getClient().getId());
o = Usermanagement.getInstance().loginUser(SID,
usernameOrEmail, Userpass, currentClient,
storePermanent);
}
if (o == null)
return null;
if (!o.getClass().isAssignableFrom(Users.class))
return o;
if (currentClient.getUser_id() != null
&& currentClient.getUser_id() > 0) {
Users u = (Users) o;
currentClient.setFirstname(u.getFirstname());
currentClient.setLastname(u.getLastname());
Collection<Set<IConnection>> conCollection = current.getScope()
.getConnections();
for (Set<IConnection> conset : conCollection) {
for (IConnection cons : conset) {
if (cons != null) {
RoomClient rcl = this.clientListManager