fix: generalise permission check for query user information (#8458)

# Which Problems Are Solved

IDPLinks list and other list endpoints can provide you with empty
results if the used user has no permission for the information.

# How the Problems Are Solved

List endpoints with subelements to users, and provided userIDQuery, will
return a PermissionDenied error if no permission for the user exsists.

# Additional Changes

Function to check for permission is re-used from the GetUserByID.

# Additional Context

Closes #8451
This commit is contained in:
Stefan Benz
2024-08-23 06:44:18 +00:00
committed by GitHub
parent 8051a63147
commit 2847806531
27 changed files with 552 additions and 111 deletions
@@ -471,6 +471,16 @@ func TestServer_ListPasskeys(t *testing.T) {
want *user.ListPasskeysResponse
wantErr bool
}{
{
name: "list passkeys, no userID",
args: args{
IamCTX,
&user.ListPasskeysRequest{
UserId: "",
},
},
wantErr: true,
},
{
name: "list passkeys, no permission",
args: args{
@@ -479,18 +489,12 @@ func TestServer_ListPasskeys(t *testing.T) {
UserId: userIDVerified,
},
},
want: &user.ListPasskeysResponse{
Details: &object.ListDetails{
TotalResult: 0,
Timestamp: timestamppb.Now(),
},
Result: []*user.Passkey{},
},
wantErr: true,
},
{
name: "list passkeys, none",
args: args{
UserCTX,
IamCTX,
&user.ListPasskeysRequest{
UserId: userIDWithout,
},
@@ -506,7 +510,7 @@ func TestServer_ListPasskeys(t *testing.T) {
{
name: "list passkeys, registered",
args: args{
UserCTX,
IamCTX,
&user.ListPasskeysRequest{
UserId: userIDRegistered,
},