Skip to content

Commit

Permalink
Check describe behavior without enough privileges
Browse files Browse the repository at this point in the history
References: #2817
  • Loading branch information
sfc-gh-asawicki committed Aug 23, 2024
1 parent d81e8f6 commit 1f8db8c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/sdk/testint/users_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -999,4 +999,24 @@ func TestInt_Users(t *testing.T) {
require.NoError(t, err)
require.False(t, fetchedDisabledUser.Disabled)
})

t.Run("issue #2817: check the describe behavior", func(t *testing.T) {
disabledUser, disabledUserCleanup := testClientHelper().User.CreateUserWithOptions(t, testClientHelper().Ids.RandomAccountObjectIdentifier(), &sdk.CreateUserOptions{ObjectProperties: &sdk.UserObjectProperties{Disable: sdk.Bool(true)}})
t.Cleanup(disabledUserCleanup)

fetchedDisabledUserDetails, err := client.Users.Describe(ctx, disabledUser.ID())
require.NoError(t, err)
require.NotNil(t, fetchedDisabledUserDetails.Disabled)
require.True(t, fetchedDisabledUserDetails.Disabled.Value)

role, roleCleanup := testClientHelper().Role.CreateRoleGrantedToCurrentUser(t)
t.Cleanup(roleCleanup)

revertRole := testClientHelper().Role.UseRole(t, role.ID())
t.Cleanup(revertRole)

fetchedDisabledUserDetails, err = client.Users.Describe(ctx, disabledUser.ID())
require.ErrorContains(t, err, "Insufficient privileges to operate on user")
require.Nil(t, fetchedDisabledUserDetails)
})
}

0 comments on commit 1f8db8c

Please sign in to comment.