MCPcopy
hub / github.com/ccfos/nightingale / AddUserAndGroups

Method AddUserAndGroups

models/user.go:1080–1093  ·  view source on GitHub ↗

AddUserAndGroups Add a user and add it to multiple groups in a single transaction

(ctx *ctx.Context, coverTeams bool)

Source from the content-addressed store, hash-verified

1078
1079// AddUserAndGroups Add a user and add it to multiple groups in a single transaction
1080func (u *User) AddUserAndGroups(ctx *ctx.Context, coverTeams bool) error {
1081
1082 // Try to add a user
1083 if err := u.Add(ctx); err != nil {
1084 return errors.WithMessage(err, "failed to add user")
1085 }
1086
1087 // Try to add a group for the user
1088 if err := UserGroupMemberSyncByUser(ctx, u, coverTeams); err != nil {
1089 return errors.WithMessage(err, "failed to add user to groups")
1090 }
1091
1092 return nil
1093}
1094
1095func (u *User) EncryptPhone() (err error) {
1096 // 从缓存获取手机号加密配置

Callers 1

SyncAddAndDelUsersMethod · 0.80

Calls 2

AddMethod · 0.95

Tested by

no test coverage detected