Skip to content

Conversation

@rawe0
Copy link
Member

@rawe0 rawe0 commented Dec 8, 2025

Implements the group functions in the client, along with an example and tests.

Functions

  • get_group_by_claim
  • get_group
  • has_member
  • get_members
  • find_groups

auth.set_client_secret("<your_client_secret_here>")
# Checks if token is expired if not return ('x-access-token', <token>)
# if expired, request a new token from reva
auth_token = auth.get_token()

Check warning

Code scanning / CodeQL

Variable defined multiple times Warning

This assignment to 'auth_token' is unnecessary as it is
redefined
before this value is used.

Copilot Autofix

AI about 15 hours ago

The best way to fix the problem without changing existing functionality is to make it clear that the two assignment options for auth_token are alternatives, not to be used together. The standard approach is to comment out one option and explain in the comments that the user should choose based on their scenario. To fix this, comment out the first assignment to auth_token on line 30 and add a brief comment to indicate that the user should uncomment the relevant line depending on whether they want to use credentials or an existing reva token. This preserves context and clarifies intent for anyone using or reading the example, ensuring no redundant assignment occurs.

All the changes are made only within the provided code block in examples/group_api_example.py, at and around lines 30 and 36.


Suggested changeset 1
examples/group_api_example.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/examples/group_api_example.py b/examples/group_api_example.py
--- a/examples/group_api_example.py
+++ b/examples/group_api_example.py
@@ -27,11 +27,12 @@
 auth.set_client_secret("<your_client_secret_here>")
 # Checks if token is expired if not return ('x-access-token', <token>)
 # if expired, request a new token from reva
-auth_token = auth.get_token()
+# Option 1: Authenticate via configured client id/secret
+# auth_token = auth.get_token()
 
-# OR if you already have a reva token
-# Checks if token is expired if not return (x-access-token', <token>)
-# if expired, throws an AuthenticationException (so you can refresh your reva token)
+# Option 2: OR if you already have a reva token
+# Checks if token is expired; if not, returns ('x-access-token', <token>)
+# If expired, throws an AuthenticationException (so you can refresh your reva token)
 token = "<your_reva_token>"
 auth_token = Auth.check_token(token)
 
EOF
@@ -27,11 +27,12 @@
auth.set_client_secret("<your_client_secret_here>")
# Checks if token is expired if not return ('x-access-token', <token>)
# if expired, request a new token from reva
auth_token = auth.get_token()
# Option 1: Authenticate via configured client id/secret
# auth_token = auth.get_token()

# OR if you already have a reva token
# Checks if token is expired if not return (x-access-token', <token>)
# if expired, throws an AuthenticationException (so you can refresh your reva token)
# Option 2: OR if you already have a reva token
# Checks if token is expired; if not, returns ('x-access-token', <token>)
# If expired, throws an AuthenticationException (so you can refresh your reva token)
token = "<your_reva_token>"
auth_token = Auth.check_token(token)

Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example, doesn't make sense.

@rawe0 rawe0 marked this pull request as ready for review December 8, 2025 16:31
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 this pull request may close these issues.

2 participants