MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / add_users_by_id

Method add_users_by_id

api/users/models.py:461–470  ·  view source on GitHub ↗
(self, user_ids: list)

Source from the content-addressed store, hash-verified

459 unique_together = ("organisation", "external_id")
460
461 def add_users_by_id(self, user_ids: list): # type: ignore[no-untyped-def,type-arg]
462 users_to_add = list(
463 FFAdminUser.objects.filter(id__in=user_ids, organisations=self.organisation)
464 )
465 if len(user_ids) != len(users_to_add):
466 missing_ids = set(users_to_add).difference({u.id for u in users_to_add})
467 raise FFAdminUser.DoesNotExist(
468 "Users %s do not exist in this organisation" % ", ".join(missing_ids)
469 )
470 self.users.add(*users_to_add)
471
472 def remove_users_by_id(self, user_ids: list): # type: ignore[no-untyped-def,type-arg]
473 self.users.remove(*user_ids)

Callers 1

add_usersMethod · 0.80

Calls 1

setFunction · 0.50

Tested by

no test coverage detected