Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log when user is activated #7027

Merged
merged 3 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/user/User.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ case class User(
with Identity
with FoxImplicits {

def toStringAnonymous: String = s"user ${_id.toString}"
def toStringAnonymous: String = s"User ${_id}"

val name: String = firstName + " " + lastName

Expand Down
1 change: 1 addition & 0 deletions app/models/user/UserService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class UserService @Inject()(conf: WkConf,
lastTaskTypeId: Option[String])(implicit ctx: DBAccessContext): Fox[User] = {

if (user.isDeactivated && activated) {
logger.info(s"Activating user ${user._id}. Access context: ${ctx.toStringAnonymous}")
Mailer ! Send(defaultMails.activatedMail(user.name, email))
}
for {
Expand Down
4 changes: 2 additions & 2 deletions app/oxalis/security/URLSharing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import models.user.User

case class SharingTokenContainer(sharingToken: String) extends DBAccessContextPayload {
def toStringAnonymous: String =
s"sharingToken ${sharingToken.take(4)}***"
s"Sharing token ${sharingToken.take(4)}***"
}

case class UserSharingTokenContainer(user: User, sharingToken: Option[String]) extends DBAccessContextPayload {
def toStringAnonymous: String =
s"user ${user._id} with sharingToken ${sharingToken.take(4)}***"
s"User ${user._id} with sharing token ${sharingToken.take(4)}***"
}

object URLSharing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ trait DBAccessContext {
}

case class AuthorizedAccessContext(t: DBAccessContextPayload) extends DBAccessContext {
override def data = Some(t)
override def data: Option[DBAccessContextPayload] = Some(t)
}

case object UnAuthorizedAccessContext extends DBAccessContext

case object GlobalAccessContext extends DBAccessContext {
override val globalAccess = true

override def toStringAnonymous: String = "global"
override def toStringAnonymous: String = "Global"
}

object DBAccessContext {
def apply(payload: Option[DBAccessContextPayload]) =
def apply(payload: Option[DBAccessContextPayload]): DBAccessContext =
payload match {
case Some(p) => AuthorizedAccessContext(p)
case _ => UnAuthorizedAccessContext
Expand Down