<!-- .github/pull_request_template.md --> ## Description Added user authorization through JWT header, reworked user and relevant RBAC models to accompany future User Permission system. ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced an automated workflow to validate server startup. - Added secure JWT token generation for improved session handling. - Enabled a new structure for permission management with role and tenant-based controls, including endpoints for creating roles, tenants, and assigning permissions. - Added methods for assigning default permissions to roles, tenants, and users. - Introduced new classes for managing default permissions for roles, tenants, and users. - **Refactor** - Streamlined authentication and user management flows with enhanced error handling. - **Tests** - Upgraded integration tests with improved database initialization and data pruning for a more stable environment. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Vasilije <8619304+Vasilije1990@users.noreply.github.com>
12 lines
448 B
Python
12 lines
448 B
Python
from datetime import datetime, timezone
|
|
from sqlalchemy import Column, ForeignKey, DateTime, UUID
|
|
from cognee.infrastructure.databases.relational import Base
|
|
|
|
|
|
class UserRole(Base):
|
|
__tablename__ = "user_roles"
|
|
|
|
created_at = Column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))
|
|
|
|
user_id = Column(UUID, ForeignKey("users.id"), primary_key=True)
|
|
role_id = Column(UUID, ForeignKey("roles.id"), primary_key=True)
|