feat: roles SPA Users, Profile, API keys, Activity
This commit is contained in:
1 parent
3db490a615
commit
34dffe222f
98 files changed
+4957
-434
No files matched your search
@@ -92,12 +92,17 @@ func (a *AcceptInviteUseCase) accept(command AcceptInviteCommand, pending invite
|
||||
return user.User{}, err
|
||||
}
|
||||
|
||||
inviterID, err := a.inviterOf(pending)
|
||||
if err != nil {
|
||||
return user.User{}, err
|
||||
}
|
||||
createdUser, err := a.inviteRepository.AcceptWithUser(pending.ID, now, user.User{
|
||||
Username: command.Username,
|
||||
Password: hashedPassword,
|
||||
Email: pending.Email,
|
||||
IsVerified: true,
|
||||
RoleID: assigned.ID,
|
||||
Username: command.Username,
|
||||
Password: hashedPassword,
|
||||
Email: pending.Email,
|
||||
IsVerified: true,
|
||||
RoleID: assigned.ID,
|
||||
RoleAssignedByID: inviterID,
|
||||
})
|
||||
if errors.Is(err, invite.ErrInviteNotFound) {
|
||||
return user.User{}, invite.ErrInviteInvalid
|
||||
@@ -109,6 +114,14 @@ func (a *AcceptInviteUseCase) accept(command AcceptInviteCommand, pending invite
|
||||
return createdUser, nil
|
||||
}
|
||||
|
||||
func (a *AcceptInviteUseCase) inviterOf(pending invite.Invite) (uint32, error) {
|
||||
assigner, err := resolveRoleAssigner(a.userRepository, pending.InvitedBy)
|
||||
if err != nil || assigner == nil {
|
||||
return 0, err
|
||||
}
|
||||
return assigner.ID, nil
|
||||
}
|
||||
|
||||
func (a *AcceptInviteUseCase) emailHasAccount(email string) bool {
|
||||
for _, existingUser := range a.userRepository.GetAll() {
|
||||
if strings.EqualFold(existingUser.Email, email) {
|
||||
|
||||
Reference in new issue
Block a user