Added basic tests for permissions. Cleaned up api tests. Changed api on permissions system.