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.
The problem with that is that although it might be faster (assuming MongoDB is more efficient than Python, which it probably is), it (in my opinion) significantly decreases the readability of the code as it implies that there is something 'special' about the first segment, and because it would require a special case for the permission string '*'.