feat: add Role (owner|admin) to the user domain, persistence model and mapper
This commit is contained in:
1 parent
162fea4afb
commit
461e93e3b5
30 files changed
+791
-48
No files matched your search
@@ -111,7 +111,7 @@ func expiredInvite(email string) invite.Invite {
|
||||
|
||||
func inviteInviterRepo(displayName string) *mockUserRepo {
|
||||
repo := newMockUserRepo()
|
||||
repo.users[7] = user.User{ID: 7, Username: "marta", DisplayName: displayName, Email: "marta@renew.example", IsVerified: true}
|
||||
repo.users[7] = user.User{ID: 7, Username: "marta", DisplayName: displayName, Email: "marta@renew.example", IsVerified: true, Role: user.RoleOwner}
|
||||
repo.nextID = 7
|
||||
return repo
|
||||
}
|
||||
@@ -478,14 +478,14 @@ func TestInvitationsHttp(t *testing.T) {
|
||||
if want.kind == "invite" {
|
||||
assertExactKeys(t, item, "id", "kind", "email", "status", "created_at")
|
||||
} else {
|
||||
assertExactKeys(t, item, "id", "kind", "username", "display_name", "status", "created_at")
|
||||
assertExactKeys(t, item, "id", "kind", "username", "display_name", "email", "role", "status", "created_at")
|
||||
}
|
||||
}
|
||||
if decodedString(t, items[2], "display_name") != "Ines Duarte" {
|
||||
t.Errorf("expected display name for ines")
|
||||
}
|
||||
if strings.Contains(rec.Body.String(), "jonas@renew.example") || strings.Contains(rec.Body.String(), "marta@renew.example") {
|
||||
t.Errorf("user emails and accepted invites must not be listed")
|
||||
if decodedString(t, items[3], "email") != "jonas@renew.example" || decodedString(t, items[4], "email") != "marta@renew.example" {
|
||||
t.Errorf("expected user emails in the list")
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user