feat: enforce youth mode policy and improve search
This commit is contained in:
@@ -1476,6 +1476,12 @@ func (t *Topic) handlePubBroadcast(msg *ClientComMessage) {
|
||||
msg.sess.queueOut(ErrPermissionDeniedReply(msg, types.TimeNow()))
|
||||
return
|
||||
}
|
||||
if msg.sess != nil && msg.sess.authLvl != auth.LevelRoot {
|
||||
if decision := imYouthModePolicyDecision(t.tenantID, asUid, imYouthActionCall, types.TimeNow()); !decision.Allowed {
|
||||
msg.sess.queueOut(imYouthPolicyReply(msg, decision))
|
||||
return
|
||||
}
|
||||
}
|
||||
if t.currentCall != nil {
|
||||
now := types.TimeNow()
|
||||
if t.currentCall.isStaleUnanswered(now, imCallTimeoutSeconds()) {
|
||||
@@ -1496,6 +1502,10 @@ func (t *Topic) handlePubBroadcast(msg *ClientComMessage) {
|
||||
msg.Pub.Content = content
|
||||
}
|
||||
if msg.sess != nil && msg.sess.authLvl != auth.LevelRoot && !isCall {
|
||||
if decision := imYouthModePolicyDecision(t.tenantID, asUid, imYouthActionMessage, msg.Timestamp); !decision.Allowed {
|
||||
msg.sess.queueOut(imYouthPolicyReply(msg, decision))
|
||||
return
|
||||
}
|
||||
if decision := imMessageCurfewDecision(t.tenantID, msg.sess.tenantCode, asUid, t.name, t.cat); !decision.Allowed {
|
||||
msg.sess.queueOut(imCurfewPolicyReply(msg, decision))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user