mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Auto-assign membership from console or server API
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user