[web] allow admins to clone projects with ranges and entire history (#32739)
* [web] add consistent aria-label to editing/reviewing toggle * [docstore] add endpoint for getting all docs with ranges * [history-v1] fix schema of chunkId when deleting old history chunk * [web] skip duplicate project lookup for resolving rootDocPath * [web] ignore new limits for root doc path when making debug copy * [web] allow admins to clone projects with ranges and entire history * [web] fix tests * [history-v1] re-order params for cloning project * [web] fix duplicate import of logger after merge * [project-history] re-order params for cloning project history metadata GitOrigin-RevId: 7fa35b4f90885dd453150a348d491ba0ec8de412
This commit is contained in:
@@ -263,12 +263,17 @@ const _ProjectController = {
|
||||
res.setTimeout(5 * 60 * 1000) // allow extra time for the copy to complete
|
||||
metrics.inc('cloned-project')
|
||||
const projectId = req.params.Project_id
|
||||
const { projectName, isDebugCopy, tags } = req.body
|
||||
let { projectName, isDebugCopy, cloneHistory, cloneRanges, tags } = req.body
|
||||
const currentUser = SessionManager.getSessionUser(req.session)
|
||||
if (!hasAdminAccess(currentUser)) {
|
||||
isDebugCopy = false
|
||||
cloneHistory = false
|
||||
cloneRanges = false
|
||||
}
|
||||
logger.debug({ projectId, projectName, isDebugCopy }, 'cloning project')
|
||||
if (!SessionManager.isUserLoggedIn(req.session)) {
|
||||
return res.json({ redir: '/register' })
|
||||
}
|
||||
const currentUser = SessionManager.getSessionUser(req.session)
|
||||
const { first_name: firstName, last_name: lastName, email } = currentUser
|
||||
try {
|
||||
const project = await ProjectDuplicator.promises.duplicate(
|
||||
@@ -276,7 +281,7 @@ const _ProjectController = {
|
||||
projectId,
|
||||
projectName,
|
||||
tags,
|
||||
isDebugCopy
|
||||
{ isDebugCopy, cloneHistory, cloneRanges }
|
||||
)
|
||||
ProjectAuditLogHandler.addEntryIfManagedInBackground(
|
||||
projectId,
|
||||
|
||||
Reference in New Issue
Block a user