Merge branch 'pull-17124' into apollo-client
This commit is contained in:
commit
45cf06e7aa
@ -186,7 +186,8 @@ class BigBlueButtonActor(
|
||||
}
|
||||
|
||||
MeetingDAO.delete(msg.meetingId)
|
||||
UserDAO.deleteAllFromMeeting(msg.meetingId)
|
||||
// Removing the meeting is enough, all other tables has "ON DELETE CASCADE"
|
||||
// UserDAO.deleteAllFromMeeting(msg.meetingId)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,15 +22,13 @@ class WhiteboardModel extends SystemConfiguration {
|
||||
}
|
||||
|
||||
private def createWhiteboard(wbId: String): Whiteboard = {
|
||||
val newWb = Whiteboard(
|
||||
Whiteboard(
|
||||
wbId,
|
||||
Array.empty[String],
|
||||
Array.empty[String],
|
||||
System.currentTimeMillis(),
|
||||
new HashMap[String, AnnotationVO]
|
||||
)
|
||||
|
||||
newWb
|
||||
}
|
||||
|
||||
private def deepMerge(test: Map[String, _], that: Map[String, _]): Map[String, _] =
|
||||
@ -76,10 +74,6 @@ class WhiteboardModel extends SystemConfiguration {
|
||||
}
|
||||
val newWb = wb.copy(annotationsMap = newAnnotationsMap)
|
||||
saveWhiteboard(newWb)
|
||||
|
||||
//Use it to add the diff only
|
||||
// annotationsAdded.map(PresAnnotationDAO.insertOrUpdate(_))
|
||||
|
||||
annotationsAdded
|
||||
}
|
||||
|
||||
@ -118,7 +112,6 @@ class WhiteboardModel extends SystemConfiguration {
|
||||
def modifyWhiteboardAccess(wbId: String, multiUser: Array[String]) {
|
||||
val wb = getWhiteboard(wbId)
|
||||
val newWb = wb.copy(multiUser = multiUser, oldMultiUser = wb.multiUser, changedModeOn = System.currentTimeMillis())
|
||||
// UserWhiteboardDAO.updateMultiuser(newWb)
|
||||
PresPageWritersDAO.updateMultiuser(newWb)
|
||||
saveWhiteboard(newWb)
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ trait ChangeLockSettingsInMeetingCmdMsgHdlr extends RightsManagementTrait {
|
||||
|
||||
val oldPermissions = MeetingStatus2x.getPermissions(liveMeeting.status)
|
||||
|
||||
MeetingStatus2x.setPermissions(liveMeeting.status, settings)
|
||||
MeetingStatus2x.setPermissions(liveMeeting.props.meetingProp.intId, liveMeeting.status, settings)
|
||||
|
||||
// Dial-in
|
||||
def buildLockMessage(meetingId: String, userId: String, lockedBy: String, locked: Boolean): BbbCommonEnvCoreMsg = {
|
||||
|
@ -3,7 +3,9 @@ package org.bigbluebutton.core.apps.users
|
||||
import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.models._
|
||||
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter }
|
||||
import org.bigbluebutton.core.util.RandomStringGenerator
|
||||
import org.bigbluebutton.core2.message.senders.{ MsgBuilder, Sender }
|
||||
|
||||
import scala.util.Random
|
||||
|
||||
trait RegisterUserReqMsgHdlr {
|
||||
@ -55,13 +57,9 @@ trait RegisterUserReqMsgHdlr {
|
||||
|
||||
val guestStatus = msg.body.guestStatus
|
||||
|
||||
val colorOptions = List("#7b1fa2", "#6a1b9a", "#4a148c", "#5e35b1", "#512da8", "#4527a0", "#311b92",
|
||||
"#3949ab", "#303f9f", "#283593", "#1a237e", "#1976d2", "#1565c0", "#0d47a1", "#0277bd", "#01579b")
|
||||
val userColor = colorOptions(Random.nextInt(colorOptions.length))
|
||||
|
||||
val regUser = RegisteredUsers.create(msg.body.intUserId, msg.body.extUserId,
|
||||
msg.body.name, msg.body.role, msg.body.authToken,
|
||||
msg.body.avatarURL, userColor, msg.body.guest, msg.body.authed, guestStatus, msg.body.excludeFromDashboard, false)
|
||||
msg.body.avatarURL, RandomStringGenerator.randomColor, msg.body.guest, msg.body.authed, guestStatus, msg.body.excludeFromDashboard, false)
|
||||
|
||||
checkUserConcurrentAccesses(regUser)
|
||||
RegisteredUsers.add(liveMeeting.registeredUsers, regUser, liveMeeting.props.meetingProp.intId)
|
||||
|
@ -6,6 +6,7 @@ import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
import org.bigbluebutton.core.models._
|
||||
import org.bigbluebutton.core.apps.users.UsersApp
|
||||
import org.bigbluebutton.core.util.RandomStringGenerator
|
||||
import org.bigbluebutton.core2.MeetingStatus2x
|
||||
|
||||
import scala.util.Random
|
||||
@ -21,9 +22,7 @@ trait UserJoinedVoiceConfEvtMsgHdlr extends SystemConfiguration {
|
||||
val guestPolicy = GuestsWaiting.getGuestPolicy(liveMeeting.guestsWaiting)
|
||||
val isDialInUser = msg.body.intId.startsWith(IntIdPrefixType.DIAL_IN)
|
||||
|
||||
val colorOptions = List("#7b1fa2", "#6a1b9a", "#4a148c", "#5e35b1", "#512da8", "#4527a0", "#311b92",
|
||||
"#3949ab", "#303f9f", "#283593", "#1a237e", "#1976d2", "#1565c0", "#0d47a1", "#0277bd", "#01579b")
|
||||
val userColor = colorOptions(Random.nextInt(colorOptions.length))
|
||||
val userColor = RandomStringGenerator.randomColor
|
||||
|
||||
def notifyModeratorsOfGuestWaiting(guest: GuestWaiting, users: Users2x, meetingId: String): Unit = {
|
||||
val moderators = Users2x.findAll(users).filter(p => p.role == Roles.MODERATOR_ROLE)
|
||||
|
@ -53,8 +53,6 @@ class MeetingDbTableDef(tag: Tag) extends Table[MeetingDbModel](tag, None, "meet
|
||||
}
|
||||
|
||||
object MeetingDAO {
|
||||
// val usersTable = TableQuery[UserTableDef]
|
||||
|
||||
def insert(meetingProps: DefaultProps) = {
|
||||
DatabaseConnection.db.run(
|
||||
TableQuery[MeetingDbTableDef].forceInsert(
|
||||
|
@ -1,8 +1,9 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import org.bigbluebutton.common2.domain.{ LockSettingsProps }
|
||||
import org.bigbluebutton.common2.domain.LockSettingsProps
|
||||
import org.bigbluebutton.core2.Permissions
|
||||
import slick.jdbc.PostgresProfile.api._
|
||||
import slick.lifted.{ ProvenShape }
|
||||
import slick.lifted.ProvenShape
|
||||
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.util.{ Failure, Success }
|
||||
@ -61,4 +62,29 @@ object MeetingLockSettingsDAO {
|
||||
case Failure(e) => DatabaseConnection.logger.error(s"Error inserting MeetingLockSettings: $e")
|
||||
}
|
||||
}
|
||||
|
||||
def update(meetingId: String, permissions: Permissions) = {
|
||||
DatabaseConnection.db.run(
|
||||
TableQuery[MeetingLockSettingsDbTableDef].insertOrUpdate(
|
||||
MeetingLockSettingsDbModel(
|
||||
meetingId = meetingId,
|
||||
disableCam = permissions.disableCam,
|
||||
disableMic = permissions.disableMic,
|
||||
disablePrivateChat = permissions.disablePrivChat,
|
||||
disablePublicChat = permissions.disablePubChat,
|
||||
disableNotes = permissions.disableNotes,
|
||||
hideUserList = permissions.hideUserList,
|
||||
lockOnJoin = permissions.lockOnJoin,
|
||||
lockOnJoinConfigurable = permissions.lockOnJoinConfigurable,
|
||||
hideViewersCursor = permissions.hideViewersCursor
|
||||
),
|
||||
)
|
||||
).onComplete {
|
||||
case Success(rowsAffected) => {
|
||||
DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated in MeetingLockSettings table!")
|
||||
}
|
||||
case Failure(e) => DatabaseConnection.logger.error(s"Error updating MeetingLockSettings: $e")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,41 +1,52 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import com.github.tminglei.slickpg._
|
||||
import spray.json.{ JsArray, JsBoolean, JsNumber, JsObject, JsString, JsValue, JsonWriter }
|
||||
import spray.json.{ _ }
|
||||
|
||||
trait PostgresProfile extends ExPostgresProfile
|
||||
with PgArraySupport // with PgDate2Support
|
||||
// with PgRangeSupport
|
||||
// with PgHStoreSupport
|
||||
// with PgPlayJsonSupport
|
||||
// with PgSearchSupport
|
||||
// with PgPostGISSupport
|
||||
// with PgNetSupport
|
||||
// with PgLTreeSupport
|
||||
{
|
||||
def pgjson = "jsonb" // jsonb support is in postgres 9.4.0 onward; for 9.3.x use "json"
|
||||
with PgArraySupport {
|
||||
// def pgjson = "jsonb" // jsonb support is in postgres 9.4.0 onward; for 9.3.x use "json"
|
||||
|
||||
// Add back `capabilities.insertOrUpdate` to enable native `upsert` support; for postgres 9.5+
|
||||
override protected def computeCapabilities: Set[slick.basic.Capability] =
|
||||
super.computeCapabilities + slick.jdbc.JdbcCapabilities.insertOrUpdate
|
||||
|
||||
override val api = MyAPI
|
||||
override val api = PgAPI
|
||||
|
||||
object MyAPI extends API with ArrayImplicits // with DateTimeImplicits
|
||||
// with JsonImplicits
|
||||
// with NetImplicits
|
||||
// with LTreeImplicits
|
||||
// with RangeImplicits
|
||||
// with HStoreImplicits
|
||||
// with SearchImplicits
|
||||
// with SearchAssistants
|
||||
object PgAPI extends API with ArrayImplicits // with DateTimeImplicits
|
||||
{
|
||||
implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
|
||||
// implicit val playJsonArrayTypeMapper =
|
||||
// new AdvancedArrayJdbcType[JsValue](pgjson,
|
||||
// (s) => utils.SimpleArrayUtils.fromString[JsValue](Json.parse(_))(s).orNull,
|
||||
// (v) => utils.SimpleArrayUtils.mkString[JsValue](_.toString())(v)
|
||||
// ).to(_.toList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object PostgresProfile extends PostgresProfile
|
||||
object PostgresProfile extends PostgresProfile
|
||||
|
||||
object JsonUtils {
|
||||
implicit object AnyJsonWriter extends JsonWriter[Any] {
|
||||
def write(x: Any): JsValue = x match {
|
||||
case n: Int => JsNumber(n)
|
||||
case s: String => JsString(s)
|
||||
case b: Boolean => JsBoolean(b)
|
||||
case f: Float => JsNumber(f)
|
||||
case d: Double => JsNumber(d)
|
||||
case m: Map[_, _] => JsObject(m.asInstanceOf[Map[String, Any]].map { case (k, v) => k -> write(v) })
|
||||
case l: List[_] => JsArray(l.map(write).toVector)
|
||||
case _ => throw new IllegalArgumentException(s"Unsupported type: ${x.getClass.getName}")
|
||||
// case _ => JsNull
|
||||
}
|
||||
}
|
||||
|
||||
// Cria um JsonWriter implícito para o tipo Map[String, Any]
|
||||
implicit val mapFormat: JsonWriter[Map[String, Any]] = new JsonWriter[Map[String, Any]] {
|
||||
def write(m: Map[String, Any]): JsValue = {
|
||||
JsObject(m.map { case (k, v) => k -> AnyJsonWriter.write(v) })
|
||||
}
|
||||
}
|
||||
|
||||
def mapToJson(genericMap: Map[String, Any]) = {
|
||||
genericMap.toJson.compactPrint
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,8 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import org.bigbluebutton.common2.msgs.AnnotationVO
|
||||
import slick.jdbc.PostgresProfile.api._
|
||||
import spray.json.{ JsValue, _ }
|
||||
|
||||
import scala.concurrent.Await
|
||||
import PostgresProfile.api._
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent.duration.Duration
|
||||
import scala.util.{ Failure, Success }
|
||||
|
||||
case class PresAnnotationDbModel(
|
||||
@ -30,45 +26,6 @@ class PresAnnotationDbTableDef(tag: Tag) extends Table[PresAnnotationDbModel](ta
|
||||
}
|
||||
|
||||
object PresAnnotationDAO {
|
||||
implicit object AnyJsonWriter extends JsonWriter[Any] {
|
||||
def write(x: Any): JsValue = x match {
|
||||
case n: Int => JsNumber(n)
|
||||
case s: String => JsString(s)
|
||||
case b: Boolean => JsBoolean(b)
|
||||
case f: Float => JsNumber(f)
|
||||
case d: Double => JsNumber(d)
|
||||
case m: Map[_, _] => JsObject(m.asInstanceOf[Map[String, Any]].map { case (k, v) => k -> write(v) })
|
||||
case l: List[_] => JsArray(l.map(write).toVector)
|
||||
case _ => throw new IllegalArgumentException(s"Unsupported type: ${x.getClass.getName}")
|
||||
// case _ => JsNull
|
||||
}
|
||||
}
|
||||
|
||||
// Cria um JsonWriter implícito para o tipo Map[String, Any]
|
||||
implicit val mapFormat: JsonWriter[Map[String, Any]] = new JsonWriter[Map[String, Any]] {
|
||||
def write(m: Map[String, Any]): JsValue = {
|
||||
JsObject(m.map { case (k, v) => k -> AnyJsonWriter.write(v) })
|
||||
}
|
||||
}
|
||||
|
||||
// def insertOrUpdate(annotation: AnnotationVO) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[PresAnnotationDbTableDef].insertOrUpdate(
|
||||
// PresAnnotationDbModel(
|
||||
// annotationId = annotation.id,
|
||||
// pageId = annotation.wbId,
|
||||
// userId = annotation.userId,
|
||||
// annotationInfo = annotation.annotationInfo.toMap.toJson.compactPrint,
|
||||
// // annotationInfo = annotation.annotationInfo.toString(),
|
||||
// lastUpdatedAt = new java.sql.Timestamp(System.currentTimeMillis())
|
||||
// )
|
||||
// )
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) inserted on PresAnnotation table!")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error inserting PresAnnotation: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
def insertOrUpdate(annotation: AnnotationVO, annotationDiff: AnnotationVO) = {
|
||||
PresAnnotationHistoryDAO.insert(annotationDiff).onComplete {
|
||||
case Success(sequence) => {
|
||||
@ -79,7 +36,7 @@ object PresAnnotationDAO {
|
||||
annotationId = annotation.id,
|
||||
pageId = annotation.wbId,
|
||||
userId = annotation.userId,
|
||||
annotationInfo = annotation.annotationInfo.toJson.compactPrint,
|
||||
annotationInfo = JsonUtils.mapToJson(annotation.annotationInfo),
|
||||
lastHistorySequence = sequence.getOrElse(0),
|
||||
lastUpdatedAt = new java.sql.Timestamp(System.currentTimeMillis())
|
||||
)
|
||||
|
@ -1,11 +1,7 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import org.bigbluebutton.common2.msgs.AnnotationVO
|
||||
import slick.jdbc.PostgresProfile.api._
|
||||
import spray.json.{ JsValue, _ }
|
||||
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.util.{ Failure, Success }
|
||||
import PostgresProfile.api._
|
||||
|
||||
case class PresAnnotationHistoryDbModel(
|
||||
sequence: Option[Int] = None,
|
||||
@ -28,26 +24,6 @@ class PresAnnotationHistoryDbTableDef(tag: Tag) extends Table[PresAnnotationHist
|
||||
}
|
||||
|
||||
object PresAnnotationHistoryDAO {
|
||||
implicit object AnyJsonWriter extends JsonWriter[Any] {
|
||||
def write(x: Any): JsValue = x match {
|
||||
case n: Int => JsNumber(n)
|
||||
case s: String => JsString(s)
|
||||
case b: Boolean => JsBoolean(b)
|
||||
case f: Float => JsNumber(f)
|
||||
case d: Double => JsNumber(d)
|
||||
case m: Map[_, _] => JsObject(m.asInstanceOf[Map[String, Any]].map { case (k, v) => k -> write(v) })
|
||||
case l: List[_] => JsArray(l.map(write).toVector)
|
||||
case _ => throw new IllegalArgumentException(s"Unsupported type: ${x.getClass.getName}")
|
||||
// case _ => JsNull
|
||||
}
|
||||
}
|
||||
|
||||
// Cria um JsonWriter implícito para o tipo Map[String, Any]
|
||||
implicit val mapFormat: JsonWriter[Map[String, Any]] = new JsonWriter[Map[String, Any]] {
|
||||
def write(m: Map[String, Any]): JsValue = {
|
||||
JsObject(m.map { case (k, v) => k -> AnyJsonWriter.write(v) })
|
||||
}
|
||||
}
|
||||
|
||||
def insert(annotationDiff: AnnotationVO) = {
|
||||
DatabaseConnection.db.run(
|
||||
@ -58,7 +34,7 @@ object PresAnnotationHistoryDAO {
|
||||
annotationId = annotationDiff.id,
|
||||
pageId = annotationDiff.wbId,
|
||||
userId = annotationDiff.userId,
|
||||
annotationInfo = annotationDiff.annotationInfo.toJson.compactPrint
|
||||
annotationInfo = JsonUtils.mapToJson(annotationDiff.annotationInfo)
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -75,44 +51,5 @@ object PresAnnotationHistoryDAO {
|
||||
annotationInfo = ""
|
||||
)
|
||||
)
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[PresAnnotationDbTableDef]
|
||||
// .filter(_.annotationId === annotationId)
|
||||
// .map(a => (a.annotationInfo, a.lastUpdatedAt))
|
||||
// .update("", new java.sql.Timestamp(System.currentTimeMillis()))
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated annotationInfo=null on PresAnnotation table!")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error updating annotationInfo=null PresAnnotation: $e")
|
||||
// }
|
||||
}
|
||||
|
||||
// def insertOrUpdate(annotation: AnnotationVO) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[PresAnnotationHistoryDbTableDef].insertOrUpdate(
|
||||
// PresAnnotationHistoryDbModel(
|
||||
// sequence = None,
|
||||
// annotationId = annotation.id,
|
||||
// pageId = annotation.wbId,
|
||||
// userId = annotation.userId,
|
||||
// annotationInfo = annotation.annotationInfo.toJson.compactPrint
|
||||
// )
|
||||
// )
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) inserted on PresAnnotationHistory table!")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error inserting PresAnnotationHistory: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
// def delete(annotationId: String) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[PresAnnotationHistoryDbTableDef]
|
||||
// .filter(_.annotationId === annotationId)
|
||||
// .map(a => (a.annotationInfo))
|
||||
// .update(""))
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated annotationInfo=null on PresAnnotationHistory table!")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error updating annotationInfo=null PresAnnotationHistory: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import org.bigbluebutton.common2.msgs.AnnotationVO
|
||||
import org.bigbluebutton.core.models.PresentationInPod
|
||||
import slick.jdbc.PostgresProfile.api._
|
||||
|
||||
@ -29,18 +28,13 @@ class PresPageDbTableDef(tag: Tag) extends Table[PresPageDbModel](tag, None, "pr
|
||||
val yOffset = column[Double]("yOffset")
|
||||
val widthRatio = column[Double]("widthRatio")
|
||||
val heightRatio = column[Double]("heightRatio")
|
||||
|
||||
// val presentation = foreignKey("presentation_fk", presentationId, Presentations)(_.presentationId, onDelete = ForeignKeyAction.Cascade)
|
||||
def * = (pageId, presentationId, num, urls, current, xOffset, yOffset, widthRatio, heightRatio) <> (PresPageDbModel.tupled, PresPageDbModel.unapply)
|
||||
}
|
||||
|
||||
object PresPageDAO {
|
||||
|
||||
// def setCurrentPage(wbId: String, userId: String, annotationId: String) = {
|
||||
def setCurrentPage(presentation: PresentationInPod, pageId: String) = {
|
||||
|
||||
// val updateSql =
|
||||
|
||||
DatabaseConnection.db.run(
|
||||
sqlu"""UPDATE pres_page SET
|
||||
"current" = (case when "pageId" = ${pageId} then true else false end)
|
||||
|
@ -6,7 +6,6 @@ import org.bigbluebutton.core.models.{ PresentationInPod }
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.util.{ Failure, Success }
|
||||
import spray.json._
|
||||
//import DefaultJsonProtocol._
|
||||
|
||||
case class PresPresentationDbModel(presentationId: String, meetingId: String, current: Boolean, downloadable: Boolean, removable: Boolean)
|
||||
|
||||
@ -16,7 +15,6 @@ class PresPresentationDbTableDef(tag: Tag) extends Table[PresPresentationDbModel
|
||||
val current = column[Boolean]("current")
|
||||
val downloadable = column[Boolean]("downloadable")
|
||||
val removable = column[Boolean]("removable")
|
||||
|
||||
// val meeting = foreignKey("meeting_fk", meetingId, Meetings)(_.meetingId, onDelete = ForeignKeyAction.Cascade)
|
||||
|
||||
def * = (presentationId, meetingId, current, downloadable, removable) <> (PresPresentationDbModel.tupled, PresPresentationDbModel.unapply)
|
||||
|
@ -67,8 +67,6 @@ class UserDbTableDef(tag: Tag) extends Table[UserDbModel](tag, None, "user") {
|
||||
}
|
||||
|
||||
object UserDAO {
|
||||
// val usersTable = TableQuery[UserTableDef]
|
||||
|
||||
def insert(meetingId: String, regUser: RegisteredUser) = {
|
||||
DatabaseConnection.db.run(
|
||||
TableQuery[UserDbTableDef].forceInsert(
|
||||
@ -126,17 +124,6 @@ object UserDAO {
|
||||
}
|
||||
}
|
||||
|
||||
// def delete(regUser: RegisteredUser) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[UserDbTableDef]
|
||||
// .filter(_.userId === regUser.id)
|
||||
// .delete
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"User ${regUser.id} deleted")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error deleting user ${regUser.id}: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
def delete(intId: String) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[UserDbTableDef]
|
||||
@ -169,14 +156,5 @@ object UserDAO {
|
||||
}
|
||||
}
|
||||
|
||||
// def insert(user: UserDbModel) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[UserDbTableDef].forceInsert(user)
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error updating user: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
@ -50,8 +50,6 @@ class UserVoiceDbTableDef(tag: Tag) extends Table[UserVoiceDbModel](tag, None, "
|
||||
|
||||
|
||||
object UserVoiceDAO {
|
||||
// val usersTable = TableQuery[UserTableDef]
|
||||
|
||||
def insert(voiceUserState: VoiceUserState) = {
|
||||
DatabaseConnection.db.run(
|
||||
TableQuery[UserVoiceDbTableDef].insertOrUpdate(
|
||||
@ -95,7 +93,6 @@ object UserVoiceDAO {
|
||||
}
|
||||
|
||||
def updateTalking(voiceUserState: VoiceUserState) = {
|
||||
// DatabaseConnection.db.run(sql"SELECT * FROM $users".as[(Int, Double, String)]).onComplete {
|
||||
val now = System.currentTimeMillis()
|
||||
|
||||
val updateSql = if(voiceUserState.talking) {
|
||||
|
@ -27,7 +27,7 @@ object Users2x {
|
||||
}
|
||||
|
||||
def remove(users: Users2x, intId: String): Option[UserState] = {
|
||||
UserDAO.delete(intId) //TODO maybe just flag online=false, instead of delete
|
||||
UserDAO.delete(intId)
|
||||
users.remove(intId)
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ object Users2x {
|
||||
_ <- users.remove(intId)
|
||||
ejectedUser <- users.removeFromCache(intId)
|
||||
} yield {
|
||||
UserDAO.delete(intId) //TODO maybe just flag online=false, instead of delete
|
||||
UserDAO.delete(intId)
|
||||
ejectedUser
|
||||
}
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ class MeetingActor(
|
||||
|
||||
MeetingStatus2x.initializePermissions(liveMeeting.status)
|
||||
|
||||
MeetingStatus2x.setPermissions(liveMeeting.status, settings)
|
||||
MeetingStatus2x.setPermissions(liveMeeting.props.meetingProp.intId, liveMeeting.status, settings)
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,5 +13,12 @@ object RandomStringGenerator {
|
||||
// Generate a random alphabnumeric string of length n
|
||||
def randomAlphanumericString(n: Int) =
|
||||
randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n)
|
||||
|
||||
def randomColor = {
|
||||
val colorOptions = List("#7b1fa2", "#6a1b9a", "#4a148c", "#5e35b1", "#512da8", "#4527a0", "#311b92",
|
||||
"#3949ab", "#303f9f", "#283593", "#1a237e", "#1976d2", "#1565c0", "#0d47a1", "#0277bd", "#01579b")
|
||||
colorOptions(random.nextInt(colorOptions.length))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
package org.bigbluebutton.core2
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
import org.bigbluebutton.core.db.MeetingLockSettingsDAO
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
import org.bigbluebutton.core.util.TimeUtil
|
||||
|
||||
case class Permissions(
|
||||
@ -98,9 +99,10 @@ object MeetingStatus2x {
|
||||
def initializeAudioSettings(status: MeetingStatus2x) = status.audioSettingsInited = true
|
||||
def permissionsEqual(status: MeetingStatus2x, other: Permissions): Boolean = status.permissions == other
|
||||
def getPermissions(status: MeetingStatus2x): Permissions = status.permissions
|
||||
def setPermissions(status: MeetingStatus2x, p: Permissions) = {
|
||||
def setPermissions(meetingId: String, status: MeetingStatus2x, p: Permissions) = {
|
||||
status.permissions = p
|
||||
status.permissionsChangedOn = System.currentTimeMillis()
|
||||
MeetingLockSettingsDAO.update(meetingId, p)
|
||||
}
|
||||
def getPermissionsChangedOn(status: MeetingStatus2x): Long = status.permissionsChangedOn
|
||||
def areNotesDisabled(status: MeetingStatus2x): Boolean = status.permissions.disableNotes
|
||||
|
@ -27,6 +27,7 @@ DROP TABLE IF EXISTS "user_voice";
|
||||
DROP TABLE IF EXISTS "user_breakoutRoom";
|
||||
DROP TABLE IF EXISTS "user";
|
||||
|
||||
drop view if exists "v_meeting_lockSettings";
|
||||
drop table if exists "meeting_breakout";
|
||||
drop table if exists "meeting_recording";
|
||||
drop table if exists "meeting_welcome";
|
||||
@ -134,6 +135,32 @@ create table "meeting_lockSettings" (
|
||||
);
|
||||
create index "idx_meeting_lockSettings_meetingId" on "meeting_lockSettings"("meetingId");
|
||||
|
||||
CREATE OR REPLACE VIEW "v_meeting_lockSettings" AS
|
||||
SELECT
|
||||
mls."meetingId",
|
||||
mls."disableCam",
|
||||
mls."disableMic",
|
||||
mls."disablePrivateChat",
|
||||
mls."disablePublicChat",
|
||||
mls."disableNotes",
|
||||
mls."hideUserList",
|
||||
mls."hideViewersCursor",
|
||||
mu."webcamsOnlyForModerator",
|
||||
CASE WHEN
|
||||
mls."disableCam" IS TRUE THEN TRUE
|
||||
WHEN mls."disableMic" IS TRUE THEN TRUE
|
||||
WHEN mls."disablePrivateChat" IS TRUE THEN TRUE
|
||||
WHEN mls."disablePublicChat" IS TRUE THEN TRUE
|
||||
WHEN mls."disableNotes" IS TRUE THEN TRUE
|
||||
WHEN mls."hideUserList" IS TRUE THEN TRUE
|
||||
WHEN mls."hideViewersCursor" IS TRUE THEN TRUE
|
||||
WHEN mu."webcamsOnlyForModerator" IS TRUE THEN TRUE
|
||||
ELSE FALSE
|
||||
END "hasActiveLockSetting"
|
||||
FROM meeting m
|
||||
JOIN "meeting_lockSettings" mls ON mls."meetingId" = m."meetingId"
|
||||
JOIN meeting_users mu ON mu."meetingId" = m."meetingId";
|
||||
|
||||
create table "meeting_group" (
|
||||
"meetingId" varchar(100) references "meeting"("meetingId") ON DELETE CASCADE,
|
||||
"groupId" varchar(100),
|
||||
|
@ -1,6 +1,16 @@
|
||||
table:
|
||||
name: meeting
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: lockSettings
|
||||
using:
|
||||
manual_configuration:
|
||||
column_mapping:
|
||||
meetingId: meetingId
|
||||
insertion_order: null
|
||||
remote_table:
|
||||
name: v_meeting_lockSettings
|
||||
schema: public
|
||||
select_permissions:
|
||||
- role: bbb_client
|
||||
permission:
|
||||
|
@ -0,0 +1,25 @@
|
||||
table:
|
||||
name: v_meeting_lockSettings
|
||||
schema: public
|
||||
configuration:
|
||||
column_config: {}
|
||||
custom_column_names: {}
|
||||
custom_name: meeting_lockSettings
|
||||
custom_root_fields: {}
|
||||
select_permissions:
|
||||
- role: bbb_client
|
||||
permission:
|
||||
columns:
|
||||
- disableCam
|
||||
- disableMic
|
||||
- disableNotes
|
||||
- disablePrivateChat
|
||||
- disablePublicChat
|
||||
- hasActiveLockSetting
|
||||
- hideUserList
|
||||
- hideViewersCursor
|
||||
- webcamsOnlyForModerator
|
||||
- meetingId
|
||||
filter:
|
||||
meetingId:
|
||||
_eq: X-Hasura-MeetingId
|
@ -5,6 +5,7 @@
|
||||
- "!include public_v_chat.yaml"
|
||||
- "!include public_v_chat_message_private.yaml"
|
||||
- "!include public_v_chat_message_public.yaml"
|
||||
- "!include public_v_meeting_lockSettings.yaml"
|
||||
- "!include public_v_pres_annotation_curr.yaml"
|
||||
- "!include public_v_pres_annotation_history_curr.yaml"
|
||||
- "!include public_v_pres_page_cursor.yaml"
|
||||
|
Loading…
Reference in New Issue
Block a user