Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving scope limits with SetUserPermissionLimits() fails #44

Closed
ripienaar opened this issue Apr 30, 2024 · 0 comments · Fixed by #48
Closed

Saving scope limits with SetUserPermissionLimits() fails #44

ripienaar opened this issue Apr 30, 2024 · 0 comments · Fixed by #48

Comments

@ripienaar
Copy link
Contributor

If we apply the following patch to Test_ScopedPermissionsMaxPayload which should be identical we get a failure:

diff --git a/tests/accounts_test.go b/tests/accounts_test.go
index 7fcac89..c51b0e0 100644
--- a/tests/accounts_test.go
+++ b/tests/accounts_test.go
@@ -203,7 +203,14 @@ func (t *ProviderSuite) Test_ScopedPermissionsMaxPayload() {
 	auth, _, a := setupTestWithOperatorAndAccount(t)
 	s, err := a.ScopedSigningKeys().AddScope("admin")
 	t.NoError(err)
-	t.NoError(s.SetMaxPayload(101))
+
+	type limitsManager interface {
+		SetUserPermissionLimits(limits jwt.UserPermissionLimits) error
+	}
+	limits := jwt.UserPermissionLimits{}
+	limits.Payload = 101
+	t.NoError(s.(limitsManager).SetUserPermissionLimits(limits))
+
 	t.Equal(int64(101), s.MaxPayload())
 	t.NoError(auth.Commit())
 
@@ -215,9 +222,9 @@ func (t *ProviderSuite) Test_ScopedPermissionsMaxPayload() {
 	a, err = o.Accounts().Get("A")
 	t.NoError(err)
 
-	scopes, err := a.ScopedSigningKeys().GetScopeByRole("admin")
+	scope, err := a.ScopedSigningKeys().GetScope(s.Key())
 	t.NoError(err)
-	t.Equal(int64(101), scopes[0].MaxPayload())
+	t.Equal(int64(101), scope.MaxPayload())
 }
 
 func (t *ProviderSuite) Test_ScopedPermissionsMaxData() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant