Permissions API

This pull request has been superseded by PR #1403