fix(middleware): log ownership lookup failures; drop dead auth surface

ownership.js caught a lookup failure, returned 500 and logged nothing -- the
file had no logger import, so a failing ownership check was invisible in the
logs. Added logging matching photoAuth.js/permissions.js
({ error, stack } plus the relevant id), response behaviour unchanged. Fixed
both swallowed catches: requireEventOwnership, the reported one, and the
byte-identical requireProjectOwnership.

Also removes AdminAuthContext.updatePasswordChanged, now dead -- superseded
by the deliberate full-page reload in onSuccess, with zero callers left.
setMustChangePassword and mustChangePassword stay; nothing else orphaned.

Refs testplan REPORT.md B13, B16.
This commit is contained in:
Paul Nothaft
2026-09-02 09:43:10 +02:00
parent 103863cbab
commit 42ba8351c1
2 changed files with 11 additions and 18 deletions
@@ -12,7 +12,6 @@ interface AdminAuthContextType {
isLoading: boolean;
error: string | null;
mustChangePassword: boolean;
updatePasswordChanged: () => void;
updateUserProfile: (updates: Partial<AdminUser>) => void;
}
@@ -98,20 +97,6 @@ export const AdminAuthProvider: React.FC<AdminAuthProviderProps> = ({ children }
setMustChangePassword(false);
};
const updatePasswordChanged = () => {
setMustChangePassword(false);
if (user) {
setUser({
...user,
mustChangePassword: false
});
sessionStorage.setItem('admin_user', JSON.stringify({
...user,
mustChangePassword: false
}));
}
};
const updateUserProfile = (updates: Partial<AdminUser>) => {
setUser((prev) => {
if (!prev) {
@@ -133,7 +118,6 @@ export const AdminAuthProvider: React.FC<AdminAuthProviderProps> = ({ children }
isLoading,
error,
mustChangePassword,
updatePasswordChanged,
updateUserProfile,
}}
>