1
0

feat: allow to find users with access to a project more freely

Related to https://kolaente.dev/vikunja/frontend/issues/2196
This commit is contained in:
kolaente
2023-04-03 18:49:04 +02:00
parent 327bb3bed9
commit a7231e197e
5 changed files with 34 additions and 2 deletions

View File

@ -105,6 +105,7 @@ func ListUsersFromProject(s *xorm.Session, l *Project, search string) (users []*
users, err = user.ListUsers(s, search, &user.ProjectUserOpts{
AdditionalCond: cond,
ReturnAllIfNoSearchProvided: true,
MatchFuzzily: true,
})
return
}

View File

@ -24,7 +24,7 @@ import (
"gopkg.in/d4l3k/messagediff.v1"
)
func TestProjectUsersFromProject(t *testing.T) {
func TestListUsersFromProject(t *testing.T) {
testuser1 := &user.User{
ID: 1,
Username: "user1",
@ -219,6 +219,11 @@ func TestProjectUsersFromProject(t *testing.T) {
args: args{l: &Project{ID: 19, OwnerID: 7}, search: "user1"},
wantUsers: []*user.User{
testuser1, // Shared Via Team readonly
testuser10, // Matches Partially, Shared Via NamespaceTeam admin
testuser11, // Matches Partially, Shared Via NamespaceUser readonly
testuser12, // Matches Partially, Shared Via NamespaceUser write
testuser13, // Matches Partially, Shared Via NamespaceUser admin
},
},
}