Implement proper ACL checks and suid permission

Placeholder, not finished yet.
Why is this being copied? There's no explanation in comments or in a commit message.