1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

Auto-assign membership from console or server API

This commit is contained in:
Eldad Fux 2020-07-10 12:06:30 +03:00
parent 2cbf58ea5a
commit f08543d669

View file

@ -316,6 +316,15 @@ $utopia->post('/v1/teams/:teamId/memberships')
$team = $projectDB->updateDocument(\array_merge($team->getArrayCopy(), [
'sum' => $team->getAttribute('sum', 0) + 1,
]));
// Attach user to team
$invitee->setAttribute('memberships', $membership, Document::SET_TYPE_APPEND);
$invitee = $projectDB->updateDocument($invitee->getArrayCopy());
if (false === $invitee) {
throw new Exception('Failed saving user to DB', 500);
}
Authorization::reset();
} else {