Search in sources :

Example 21 with User

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();
}
Also used : User(org.apache.openmeetings.db.entity.user.User)

Example 22 with User

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;
}
Also used : User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) SOAPLogin(org.apache.openmeetings.db.entity.server.SOAPLogin) Sessiondata(org.apache.openmeetings.db.entity.server.Sessiondata) RemoteSessionObject(org.apache.openmeetings.db.entity.server.RemoteSessionObject) Date(java.util.Date)

Example 23 with User

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;
}
Also used : User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) OmException(org.apache.openmeetings.util.OmException)

Example 24 with User

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));
}
Also used : User(org.apache.openmeetings.db.entity.user.User) Client(org.apache.openmeetings.db.entity.basic.Client)

Example 25 with User

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));
}
Also used : AjaxDatePicker(com.googlecode.wicket.kendo.ui.form.datetime.local.AjaxDatePicker) CountryDropDown(org.apache.openmeetings.web.util.CountryDropDown) Group(org.apache.openmeetings.db.entity.user.Group) User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) PropertyModel(org.apache.wicket.model.PropertyModel) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler) Salutation(org.apache.openmeetings.db.entity.user.User.Salutation) CheckBox(org.apache.wicket.markup.html.form.CheckBox) Select2MultiChoice(org.wicketstuff.select2.Select2MultiChoice) ChoiceRenderer(org.apache.wicket.markup.html.form.ChoiceRenderer)

Aggregations

User (org.apache.openmeetings.db.entity.user.User)101 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)29 Test (org.junit.Test)25 Date (java.util.Date)11 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)10 ArrayList (java.util.ArrayList)8 ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)8 OmException (org.apache.openmeetings.util.OmException)8 Path (javax.ws.rs.Path)7 MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)7 Room (org.apache.openmeetings.db.entity.room.Room)7 AbstractJUnitDefaults.getUser (org.apache.openmeetings.AbstractJUnitDefaults.getUser)6 Client (org.apache.openmeetings.db.entity.basic.Client)6 Address (org.apache.openmeetings.db.entity.user.Address)5 Group (org.apache.openmeetings.db.entity.user.Group)5 GroupDao (org.apache.openmeetings.db.dao.user.GroupDao)4 AppointmentDTO (org.apache.openmeetings.db.dto.calendar.AppointmentDTO)4 OAuthUser (org.apache.openmeetings.db.dto.user.OAuthUser)4 Recording (org.apache.openmeetings.db.entity.record.Recording)4 AbstractJUnitDefaults.createUser (org.apache.openmeetings.AbstractJUnitDefaults.createUser)3