Partial implementation of access-rights checks. Needs some more work,
and brainstorm