Permission completely re-written and brought up to appropriate coding standards

In this pull request:
- Super User checkboxes work appropriately
- Code actually legible
- Major fixes to permission syncing; bug fixes