This represents an organization structure similar to organization but within a facility
A single root can only exist and the root organization is created automatically along with the facility.
The root organization cannot have any children.
Organizations with type govt and role can only be managed by the superadmin
Viewing organizations with type govt is allowed to anyone within care to maintain governance structures
Creating sub organizations requires the can_create_organization permission
Viewing organizations require the can_view_organization permission
Viewing users within organizations require the can_list_organization_users permission
Adding/Removing users within organizations require the can_manage_organization_users permission
When adding users into organizations a role is required, the maximum role that can be applied should be a subset of the roles that the current user has in the organization. similarly remove can only be performed by users with more permissions that the user that is about to be deleted.
Organizations cannot be deleted until all its children are deleted.
Organizations can be deleted with the can_delete_organization permission
System generated organization cannot be deleted.
Organizations with type govt or system generated organizations cannot be edited ( name and description )