- Deleting a tag now untags only that tag; the manifest is removed only when no other tag references the same digest (previously deleting by digest also removed every sibling tag). - Add repository deletion. The registry API cannot drop a repository from the catalog, so empty repositories stayed in the UI forever with nothing left to delete. The app now mounts registry storage and removes the repository's metadata directories after deleting its manifests. - Run `registry garbage-collect` daily (GC_HOUR_UTC) so deleted blobs free disk. - Disable Watchtower for the locally built app image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
587 B
TypeScript
18 lines
587 B
TypeScript
import type { SessionUser } from './session'
|
|
|
|
export async function requireDeletePermission(session: SessionUser, repository: string) {
|
|
if (session.role === 'ADMIN') return
|
|
|
|
const user = await prisma.user.findUnique({
|
|
where: { id: session.id },
|
|
include: { acls: true },
|
|
})
|
|
if (!user) {
|
|
throw createError({ statusCode: 401, statusMessage: 'Unauthorized' })
|
|
}
|
|
const allowed = allowedActionsForRepo(user, repository)
|
|
if (!allowed.includes('delete') && !allowed.includes('*')) {
|
|
throw createError({ statusCode: 403, statusMessage: 'Delete not allowed' })
|
|
}
|
|
}
|