Add Permissions Model.

This feature is a WIP.

Future PRs:
1) Add UI for App owners to specify permissions and provide descriptions.
2) Update Core to use permissions, including having a way to populate the perms DB with core permissions.
3) Add UI for viewing permissions, including users and groups that have those permissions.
4) Add UI for assigning permissions to groups and users.
It can do string prefix matching, right? (I think.) That could help reduce the number of comparisons we need to do.

On the other hand, there likely aren't going to be enough permissions for this to be terrible, so adding that now would probably be premature optimization.