Auto-assign membership from console or server API
This commit is contained in:
parent
2cbf58ea5a
commit
f08543d669
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue