mirror of
https://github.com/standardnotes/server
synced 2026-01-16 20:04:32 -05:00
fix: add more readonly access debug logs
This commit is contained in:
@@ -77,6 +77,7 @@ export abstract class AuthMiddleware extends BaseMiddleware {
|
||||
response.locals.readOnlyAccess = decodedToken.session?.readonly_access ?? false
|
||||
if (response.locals.readonlyAccess) {
|
||||
this.logger.info('User operates on read-only access', {
|
||||
codeTag: 'AuthMiddleware',
|
||||
userId: response.locals.user.uuid,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -28,6 +28,12 @@ export class GRPCSyncingServerServiceProxy {
|
||||
metadata.set('x-user-uuid', response.locals.user.uuid)
|
||||
metadata.set('x-snjs-version', request.headers['x-snjs-version'] as string)
|
||||
metadata.set('x-read-only-access', response.locals.readonlyAccess ? 'true' : 'false')
|
||||
if (response.locals.readonlyAccess) {
|
||||
this.logger.info('Syncing with read-only access', {
|
||||
codeTag: 'GRPCSyncingServerServiceProxy',
|
||||
userId: response.locals.user.uuid,
|
||||
})
|
||||
}
|
||||
if (response.locals.session) {
|
||||
metadata.set('x-session-uuid', response.locals.session.uuid)
|
||||
}
|
||||
|
||||
@@ -74,9 +74,17 @@ export class SyncingServer implements ISyncingServer {
|
||||
}
|
||||
|
||||
const apiVersion = call.request.hasApiVersion() ? (call.request.getApiVersion() as string) : ApiVersion.v20161215
|
||||
const userUuid = call.metadata.get('x-user-uuid').pop() as string
|
||||
const readOnlyAccess = call.metadata.get('x-read-only-access').pop() === 'true'
|
||||
if (readOnlyAccess) {
|
||||
this.logger.info('Syncing with read-only access', {
|
||||
codeTag: 'SyncingServer',
|
||||
userId: userUuid,
|
||||
})
|
||||
}
|
||||
|
||||
const syncResult = await this.syncItemsUseCase.execute({
|
||||
userUuid: call.metadata.get('x-user-uuid').pop() as string,
|
||||
userUuid,
|
||||
itemHashes,
|
||||
computeIntegrityHash: call.request.hasComputeIntegrity() ? call.request.getComputeIntegrity() === true : false,
|
||||
syncToken: call.request.hasSyncToken() ? call.request.getSyncToken() : undefined,
|
||||
@@ -85,7 +93,7 @@ export class SyncingServer implements ISyncingServer {
|
||||
contentType: call.request.hasContentType() ? call.request.getContentType() : undefined,
|
||||
apiVersion,
|
||||
snjsVersion: call.metadata.get('x-snjs-version').pop() as string,
|
||||
readOnlyAccess: call.metadata.get('x-read-only-access').pop() === 'true',
|
||||
readOnlyAccess,
|
||||
sessionUuid: call.metadata.get('x-session-uuid').pop() as string,
|
||||
sharedVaultUuids,
|
||||
isFreeUser: call.metadata.get('x-is-free-user').pop() === 'true',
|
||||
|
||||
Reference in New Issue
Block a user