| 261 | ) |
| 262 | |
| 263 | def add_organisation( |
| 264 | self, organisation: Organisation, role: OrganisationRole = OrganisationRole.USER |
| 265 | ) -> None: |
| 266 | UserOrganisation.objects.create( |
| 267 | user=self, organisation=organisation, role=role.name |
| 268 | ) |
| 269 | default_groups = organisation.permission_groups.filter(is_default=True) |
| 270 | self.permission_groups.add(*default_groups) |
| 271 | |
| 272 | def remove_organisation(self, organisation): # type: ignore[no-untyped-def] |
| 273 | UserOrganisation.objects.filter(user=self, organisation=organisation).delete() |