use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class UserForm method onValidate.
@Override
protected void onValidate() {
User u = getModelObject();
if (!userDao.checkLogin(login.getConvertedInput(), u.getType(), u.getDomainId(), u.getId())) {
error(getString("error.login.inuse"));
}
super.onValidate();
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class WebSession method signIn.
public boolean signIn(String secureHash, boolean markUsed) {
SOAPLogin soapLogin = soapDao.get(secureHash);
if (soapLogin == null) {
return false;
}
if (!soapLogin.isUsed() || soapLogin.getAllowSameURLMultipleTimes()) {
Sessiondata sd = sessionDao.check(soapLogin.getSessionHash());
if (sd.getXml() != null) {
RemoteSessionObject remoteUser = RemoteSessionObject.fromXml(sd.getXml());
if (remoteUser != null && !Strings.isEmpty(remoteUser.getExternalUserId())) {
User user = userDao.getExternalUser(remoteUser.getExternalUserId(), remoteUser.getExternalUserType());
if (user == null) {
user = userDao.getNewUserInstance(null);
user.setFirstname(remoteUser.getFirstname());
user.setLastname(remoteUser.getLastname());
user.setLogin(remoteUser.getUsername());
user.setType(Type.external);
user.setExternalId(remoteUser.getExternalUserId());
user.setExternalType(remoteUser.getExternalUserType());
user.getRights().clear();
user.getRights().add(Right.Room);
user.getAddress().setEmail(remoteUser.getEmail());
user.setPictureuri(remoteUser.getPictureUrl());
} else {
user.setFirstname(remoteUser.getFirstname());
user.setLastname(remoteUser.getLastname());
user.setPictureuri(remoteUser.getPictureUrl());
}
user = userDao.update(user, null);
if (markUsed) {
soapLogin.setUsed(true);
soapLogin.setUseDate(new Date());
soapDao.update(soapLogin);
}
roomId = soapLogin.getRoomId();
sd.setUserId(user.getId());
sd.setRoomId(roomId);
sessionDao.update(sd);
setUser(user, null);
recordingId = soapLogin.getRecordingId();
soap = soapLogin;
return true;
}
}
}
return false;
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class WebSession method signIn.
public boolean signIn(String login, String password, Type type, Long domainId) throws OmException {
User u;
switch(type) {
case ldap:
u = ldapManager.login(login, password, domainId);
break;
case user:
/* we will allow login against internal DB in case user 'guess' LDAP password */
u = userDao.login(login, password);
break;
case oauth:
// we did all the checks at this stage, just set the user
u = userDao.getByLogin(login, Type.oauth, domainId);
break;
default:
throw new OmException("error.unknown");
}
if (u == null) {
return false;
}
signIn(u);
return true;
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class NicknameDialog method onSubmit.
@Override
protected void onSubmit(AjaxRequestTarget target) {
final User u = form.getModelObject();
final Client c = room.getClient();
c.getUser().setFirstname(u.getFirstname()).setLastname(u.getLastname());
room.broadcast(cm.update(c));
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class GeneralUserForm method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
add(email);
email.setLabel(Model.of(getString("119")));
email.add(RfcCompliantEmailAddressValidator.getInstance());
add(new DropDownChoice<>("salutation", Arrays.asList(Salutation.values()), new ChoiceRenderer<Salutation>() {
private static final long serialVersionUID = 1L;
@Override
public Object getDisplayValue(Salutation object) {
return getString("user.salutation." + object.name());
}
@Override
public String getIdValue(Salutation object, int index) {
return object.name();
}
}));
add(new TextField<String>("firstname"));
add(new TextField<String>("lastname"));
add(new DropDownChoice<>("timeZoneId", AVAILABLE_TIMEZONES));
add(new LanguageDropDown("languageId"));
add(new TextField<String>("address.phone"));
add(new CheckBox("sendSMS"));
add(new AjaxDatePicker("age", new PropertyModel<LocalDate>(this, "age"), WebSession.get().getLocale()) {
private static final long serialVersionUID = 1L;
@Override
public void onValueChanged(IPartialPageRequestHandler target) {
User u = GeneralUserForm.this.getModelObject();
u.setAge(CalendarHelper.getDate(age, u.getTimeZoneId()));
}
});
add(new TextField<String>("address.street"));
add(new TextField<String>("address.additionalname"));
add(new TextField<String>("address.zip"));
add(new TextField<String>("address.town"));
add(new CountryDropDown("address.country"));
add(new TextArea<String>("address.comment"));
add(new Select2MultiChoice<>("groupUsers", null, new RestrictiveChoiceProvider<GroupUser>() {
private static final long serialVersionUID = 1L;
@Override
public String getDisplayValue(GroupUser choice) {
return choice.getGroup().getName();
}
@Override
public String toId(GroupUser choice) {
Long id = choice.getGroup().getId();
return id == null ? null : "" + id;
}
@Override
public void query(String term, int page, Response<GroupUser> response) {
for (GroupUser ou : grpUsers) {
if (Strings.isEmpty(term) || ou.getGroup().getName().contains(term)) {
response.add(ou);
}
}
}
@Override
public GroupUser fromId(String _id) {
Long id = Long.parseLong(_id);
User u = GeneralUserForm.this.getModelObject();
Group g = groupDao.get(id);
GroupUser gu = new GroupUser(g, u);
int idx = grpUsers.indexOf(gu);
return idx < 0 ? gu : grpUsers.get(idx);
}
}).setLabel(Model.of(getString("161"))).setRequired(isAdminForm && hasGroupAdminLevel(getRights())).setEnabled(isAdminForm));
}
Aggregations