Correct permission checks for bug #12399