Skip to content

Commit

Permalink
Update doc example JS Hook adding user to group (#4900)
Browse files Browse the repository at this point in the history
  • Loading branch information
allenleetc authored Oct 9, 2024
1 parent 120c78d commit 881f1fb
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions docs/source/teams/pluggable_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,22 @@ async function Hook(context) {
groupName
);
}
// Add signed-in user to the group and update the group
group.userIds.push(user.id);
const updatedGroupName = undefined;
const updatedGroupDescription = undefined;
const updatedGroupUserIds = [...group.userIds, user.id];
await services.directory.groups.updateGroup(
orgId,
group.id,
updatedGroupName,
updatedGroupDescription,
updatedGroupUserIds
);

if (!group.userIds.includes(user.id)) {
// Add signed-in user to the group and update the group
const updatedGroupName = undefined;
const updatedGroupDescription = undefined;
const updatedGroupUserIds = [...group.userIds, user.id];
const accessorId = undefined;
await services.directory.groups.updateGroup(
orgId,
group.id,
accessorId,
updatedGroupName,
updatedGroupDescription,
updatedGroupUserIds
);
}
}
}
```
Expand Down

0 comments on commit 881f1fb

Please sign in to comment.