Revert "[web] Add User logs to Group Audit Logs view (#29155)" (#29479)

This reverts commit c455edc5a700ba24e73a16b2a66b50cb92f24176.

GitOrigin-RevId: 40a1516ab9cec690d0487a0a870b9fab17598d60
This commit is contained in:
Miguel Serrano
2025-11-04 09:05:47 +00:00
committed by Copybot
parent 3522923d4e
commit 1a3ce3f192
5 changed files with 21 additions and 113 deletions
@@ -98,13 +98,6 @@ const SubscriptionLocator = {
)
},
async getUniqueManagedSubscriptionMemberOf(userId) {
return await Subscription.findOne(
{ member_ids: userId, managedUsersEnabled: true },
{ _id: 1 }
)
},
async getGroupsWithEmailInvite(email) {
return await Subscription.find({ invited_emails: email }).exec()
},
@@ -1,8 +1,6 @@
const OError = require('@overleaf/o-error')
const logger = require('@overleaf/logger')
const { UserAuditLogEntry } = require('../../models/UserAuditLogEntry')
const { callbackify } = require('util')
const SubscriptionLocator = require('../Subscription/SubscriptionLocator')
function _canHaveNoIpAddressId(operation, info) {
if (operation === 'join-group-subscription') return true
@@ -29,9 +27,6 @@ function _canHaveNoInitiatorId(operation, info) {
if (operation === 'release-managed-user' && info.script) return true
}
// events that are visible to managed user admins in Group Audit Logs view
const MANAGED_GROUP_USER_EVENTS = ['login', 'reset-password', 'update-password']
/**
* Add an audit log entry
*
@@ -73,25 +68,10 @@ async function addEntry(userId, operation, initiatorId, ipAddress, info = {}) {
ipAddress,
}
if (MANAGED_GROUP_USER_EVENTS.includes(operation)) {
try {
const managedSubscription =
await SubscriptionLocator.promises.getUniqueManagedSubscriptionMemberOf(
userId
)
if (managedSubscription) {
entry.managedSubscriptionId = managedSubscription._id
}
} catch (err) {
logger.error({ err, userId }, 'failed to lookup managed subscription')
}
}
await UserAuditLogEntry.create(entry)
}
const UserAuditLogHandler = {
MANAGED_GROUP_USER_EVENTS,
addEntry: callbackify(addEntry),
promises: {
addEntry,
@@ -4,7 +4,6 @@ const { Schema } = mongoose
const UserAuditLogEntrySchema = new Schema(
{
userId: { type: Schema.Types.ObjectId, index: true },
managedSubscriptionId: { type: Schema.Types.ObjectId, index: true },
info: { type: Object },
initiatorId: { type: Schema.Types.ObjectId },
ipAddress: { type: String },