Add tables, forms, and program logic for roles/permissions

Many other small changes