Skip to content

Add scopes in auth#76

Merged
JBorrow merged 6 commits intomainfrom
scopes-in-auth
Oct 29, 2025
Merged

Add scopes in auth#76
JBorrow merged 6 commits intomainfrom
scopes-in-auth

Conversation

@JBorrow
Copy link
Copy Markdown
Member

@JBorrow JBorrow commented Oct 29, 2025

Uses the scopes to bypass additional authentication requirements if the user owns the administrator grant.

@JBorrow JBorrow requested a review from Copilot October 29, 2025 21:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements scope-based authorization for admin users in addition to the existing group-based access control. The main change introduces a scopes parameter throughout the service and API layers, allowing users with the "hippo:admin" scope to bypass group-based access restrictions.

Key changes:

  • Added scopes parameter to all service functions that perform access checks
  • Modified check_user_access() to grant access when "hippo:admin" is in scopes
  • Updated search and read functions to skip group-based filtering when "hippo:admin" scope is present
  • Updated all web and API endpoints to pass request.auth.scopes to service functions
  • Updated templates to check scopes instead of groups for admin access

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
hipposerve/service/acl.py Core access control logic updated to check scopes for admin access
hipposerve/service/product.py All product service functions updated to accept and use scopes parameter
hipposerve/service/collection.py All collection service functions updated to accept and use scopes parameter
hipposerve/api/product.py API endpoints updated to pass scopes from request.auth
hipposerve/api/relationships.py Relationship endpoints updated to pass scopes from request.auth
hipposerve/web/init.py Web views updated to pass scopes from request.auth
hipposerve/web/search.py Search endpoints updated to pass scopes from request.auth
hipposerve/web/auth.py User page endpoint updated to pass scopes
hipposerve/web/templates/*.html Templates updated to check scopes for admin access
tests/test_services/*.py All test cases updated to pass scopes parameter
upload_cameras.py New script for uploading camera timelapses
revise_metadata.py New script for revising product metadata
make_collection.py New script for creating collections
app.py New marimo app for product management
.gitignore Added patterns for uv.lock, .mp4, and product.json files
Comments suppressed due to low confidence (3)

hipposerve/web/init.py:139

  • Call to function read with too few arguments; should be no fewer than 3.
    collection_instance = await collection.read(id, request.user.groups)

hipposerve/web/init.py:154

  • Call to function read with too few arguments; should be no fewer than 3.
    collection_instance = await collection.read(id, request.user.groups)

tests/test_services/conftest.py:144

  • Call to function delete with too few arguments; should be no fewer than 3.
    await collection.delete(
        id=data.id,
        groups=created_user.groups,
    )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hipposerve/web/search.py Outdated
Comment thread hipposerve/web/search.py Outdated
Comment thread hipposerve/web/search.py Outdated
Comment thread hipposerve/web/search.py Outdated
Comment thread hipposerve/web/auth.py Outdated
Comment thread tests/test_services/test_collection_service.py Outdated
Comment thread tests/test_services/test_oversized_collection.py Outdated
Comment thread tests/test_services/test_hierarchical_collection.py Outdated
Comment thread tests/test_services/test_hierarchical_collection.py Outdated
Comment thread hipposerve/service/collection.py Outdated
@JBorrow JBorrow merged commit 458866a into main Oct 29, 2025
6 checks passed
@JBorrow JBorrow deleted the scopes-in-auth branch October 29, 2025 21:27
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