hunter permission no longer allows identifying players

pull/6119/head
Thibault Duplessis 2020-03-03 10:32:16 -06:00
parent 488295f7ce
commit 4b814ac9d4
4 changed files with 21 additions and 6 deletions

View File

@ -335,7 +335,7 @@ final class User(
val spyFu = env.security.userSpy(user).logTimeIfGt(s"$username security.userSpy", 2 seconds)
val others = spyFu flatMap { spy =>
val familyUserIds = user.id :: spy.otherUserIds.toList
env.user.noteApi.forMod(familyUserIds).logTimeIfGt(s"$username noteApi.forMod", 2 seconds) zip
(isGranted(_.ModNote) ?? env.user.noteApi.forMod(familyUserIds).logTimeIfGt(s"$username noteApi.forMod", 2 seconds)) zip
env.playban.api.bans(familyUserIds).logTimeIfGt(s"$username playban.bans", 2 seconds) zip
lila.security.UserSpy.withMeSortedWithEmails(env.user.repo, user, spy.otherUsers) map {
case notes ~ bans ~ othersWithEmail =>
@ -343,7 +343,8 @@ final class User(
}
}
val identification = spyFu map { spy =>
html.user.mod.identification(spy, env.security.printBan.blocks).some
(isGranted(_.Doxing) || (user.lameOrAlt && !user.hasTitle)) option
html.user.mod.identification(spy, env.security.printBan.blocks)
}
val irwin = env.irwin.api.reports.withPovs(user) map {
_ ?? { reps =>

View File

@ -174,7 +174,7 @@ object mod {
)
)
},
isGranted(_.SetEmail) ?? frag(
(isGranted(_.Doxing) && isGranted(_.SetEmail)) ?? frag(
postForm(cls := "email", action := routes.Mod.setEmail(u.username))(
st.input(
tpe := "email",
@ -507,10 +507,13 @@ object mod {
tbody(
othersWithEmail.others.map {
case lila.security.UserSpy.OtherUser(o, byIp, byFp) =>
val dox = isGranted(_.Doxing) || (o.lameOrAlt && !o.hasTitle)
val myNotes = notes.filter(_.to == o.id)
tr(o == u option (cls := "same"))(
td(dataSort := o.id)(userLink(o, withBestRating = true, params = "?mod")),
td(othersWithEmail emailValueOf o),
if (dox || o == u) td(dataSort := o.id)(userLink(o, withBestRating = true, params = "?mod"))
else td,
if (dox) td(othersWithEmail emailValueOf o)
else td,
td(dataSort := (byIp ?? 3) + (byFp ?? 1))(
if (o == u) "-"
else List(byIp option "IP", byFp option "Print").flatten.mkString(", ")

View File

@ -43,6 +43,7 @@ object Permission {
case object Coach extends Permission("ROLE_COACH")
case object Teacher extends Permission("ROLE_TEACHER")
case object ModNote extends Permission("ROLE_MOD_NOTE")
case object ViewIpPrint extends Permission("ROLE_VIEW_IP_PRINT")
case object RemoveRanking extends Permission("ROLE_REMOVE_RANKING")
case object ReportBan extends Permission("ROLE_REPORT_BAN")
case object ModMessage extends Permission("ROLE_MOD_MESSAGE")
@ -80,17 +81,26 @@ object Permission {
ModLog,
SeeInsight,
UserSearch,
ModNote,
RemoveRanking,
ModMessage
)
)
case object Doxing
extends Permission(
"ROLE_DOXING",
List(
ModNote,
ViewIpPrint
)
)
case object Admin
extends Permission(
"ROLE_ADMIN",
List(
Hunter,
Doxing,
ModerateForum,
IpBan,
PrintBan,

View File

@ -76,6 +76,7 @@ case class User(
def lame = marks.boost || marks.engine
def lameOrTroll = lame || marks.troll
def lameOrAlt = lame || marks.alt
def lameOrTrollOrAlt = lameOrTroll || marks.alt
def withMarks(f: UserMarks => UserMarks) = copy(marks = f(marks))