Search in sources :

Example 1 with GetUserInfo

use of org.olat.modules.vitero.model.GetUserInfo in project OpenOLAT by OpenOLAT.

the class ViteroManager method removeFromRoom.

public ViteroStatus removeFromRoom(ViteroBooking booking, Identity identity) throws VmsNotAvailableException {
    GetUserInfo userInfo = getVmsUserId(identity, true);
    int userId = userInfo.getUserId();
    if (userId < 0) {
        // nothing to remove
        return new ViteroStatus();
    }
    return removeFromRoom(booking, userId);
}
Also used : GetUserInfo(org.olat.modules.vitero.model.GetUserInfo) ViteroStatus(org.olat.modules.vitero.model.ViteroStatus)

Example 2 with GetUserInfo

use of org.olat.modules.vitero.model.GetUserInfo in project OpenOLAT by OpenOLAT.

the class ViteroManager method getBookingInFutures.

public List<ViteroBooking> getBookingInFutures(Identity identity) throws VmsNotAvailableException {
    GetUserInfo userInfo = getVmsUserId(identity, false);
    int userId = userInfo.getUserId();
    if (userId > 0) {
        List<Booking_Type> bookings = getBookingInFutureByUserId(userId);
        return convert(bookings);
    }
    return Collections.emptyList();
}
Also used : GetUserInfo(org.olat.modules.vitero.model.GetUserInfo) Booking_Type(de.vitero.schema.booking.Booking_Type)

Example 3 with GetUserInfo

use of org.olat.modules.vitero.model.GetUserInfo in project OpenOLAT by OpenOLAT.

the class ViteroManager method getVmsUserId.

protected GetUserInfo getVmsUserId(Identity identity, boolean create) throws VmsNotAvailableException {
    int userId;
    boolean created = false;
    closeDBSessionSafely();
    Authentication authentication = securityManager.findAuthentication(identity, VMS_PROVIDER);
    if (authentication == null) {
        if (create) {
            created = true;
            userId = createVmsUser(identity);
            if (userId > 0) {
                securityManager.createAndPersistAuthentication(identity, VMS_PROVIDER, Integer.toString(userId), null, null);
            }
        } else {
            userId = -1;
        }
    } else {
        userId = Integer.parseInt(authentication.getAuthusername());
    }
    closeDBSessionSafely();
    return new GetUserInfo(created, userId);
}
Also used : GetUserInfo(org.olat.modules.vitero.model.GetUserInfo) Authentication(org.olat.basesecurity.Authentication)

Example 4 with GetUserInfo

use of org.olat.modules.vitero.model.GetUserInfo in project OpenOLAT by OpenOLAT.

the class ViteroManager method isUserOf.

public boolean isUserOf(ViteroBooking booking, Identity identity) throws VmsNotAvailableException {
    boolean member = false;
    GetUserInfo userInfo = getVmsUserId(identity, false);
    int userId = userInfo.getUserId();
    if (userId > 0) {
        List<Usertype> users = getVmsUsersByGroup(booking.getGroupId());
        if (users != null) {
            for (Usertype user : users) {
                if (userId == user.getId()) {
                    member = true;
                }
            }
        }
    }
    return member;
}
Also used : Usertype(de.vitero.schema.user.Usertype) GetUserInfo(org.olat.modules.vitero.model.GetUserInfo)

Example 5 with GetUserInfo

use of org.olat.modules.vitero.model.GetUserInfo in project OpenOLAT by OpenOLAT.

the class ViteroManager method deleteUserData.

@Override
public void deleteUserData(Identity identity, String newDeletedUserName, File archivePath) {
    if (!viteroModule.isDeleteVmsUserOnUserDelete())
        return;
    try {
        GetUserInfo userInfo = getVmsUserId(identity, false);
        int userId = userInfo.getUserId();
        if (userId > 0) {
            deleteVmsUser(userId);
        }
    } catch (VmsNotAvailableException e) {
        log.error("Cannot delete a vms user after a OLAT user deletion.", e);
    }
}
Also used : GetUserInfo(org.olat.modules.vitero.model.GetUserInfo)

Aggregations

GetUserInfo (org.olat.modules.vitero.model.GetUserInfo)16 ConnectException (java.net.ConnectException)6 ParseException (java.text.ParseException)6 WebServiceException (javax.xml.ws.WebServiceException)6 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)6 ConnectTimeoutException (org.apache.commons.httpclient.ConnectTimeoutException)6 ErrorCode (org.olat.modules.vitero.model.ErrorCode)6 Codetype (de.vitero.schema.sessioncode.Codetype)4 Calendar (java.util.Calendar)4 Date (java.util.Date)4 ViteroStatus (org.olat.modules.vitero.model.ViteroStatus)4 Booking_Type (de.vitero.schema.booking.Booking_Type)2 ChangeGroupRoleRequest (de.vitero.schema.group.ChangeGroupRoleRequest)2 Group (de.vitero.schema.group.Group)2 Groupiduserid (de.vitero.schema.group.Groupiduserid)2 CreatePersonalBookingSessionCodeRequest (de.vitero.schema.sessioncode.CreatePersonalBookingSessionCodeRequest)2 CreateVmsSessionCodeRequest (de.vitero.schema.sessioncode.CreateVmsSessionCodeRequest)2 Usertype (de.vitero.schema.user.Usertype)2 Authentication (org.olat.basesecurity.Authentication)2 BusinessGroup (org.olat.group.BusinessGroup)2