role: Add a `permissions` field to manage pems locally
role: Assign clear role for primary department
role: Forbid removing agent primary role
Merge pull request #1539 from greezybacon/feature/role-permission-field

Slight rework of Role feature
orm: Improve Dept's use of ORM

The commit also renames some fields in department table.
Role-based Access

Introduce the concept of role-based access for agents.
roles : Implement role-based access system-wide
upgrade: Add upgrade/migration

Adds migration patch for role-based access
orm: Improve Dept's use of ORM

The commit also renames some fields in department table.
Make threads generic

Detach conversation thread from ticket to make it more generic. Any object
can now have its own thread complete with entry type and attachments.
Add centralized object model registry
Fix attachment fetching to be object based
Use generic attachment table

Use generic attachment table for all attachments system-wide.
Drop thread entry attachment table
Use criteria lookup to get thread entries
Make threads generic

Detach conversation thread from ticket to make it more generic. Any object
can now have its own thread complete with entry type and attachments.
Add centralized object model registry
Fix attachment fetching to be object based
Use generic attachment table

Use generic attachment table for all attachments system-wide.
Drop thread entry attachment table
Use criteria lookup to get thread entries
tabs: Make tabs more generic and dynamic