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);
}
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();
}
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);
}
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;
}
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);
}
}
Aggregations