feat: update access layer governance and visibility checks
- Enhanced ACCESS_LAYER_AND_GOVERNANCE_PLAN.md with additional details on heuristic checks and testing procedures for cross-tenant scenarios. - Updated club_tenancy.py to recommend using `library_content_visible_to_profile` for exercise visibility checks. - Refactored multiple routers to utilize `library_content_visible_to_profile`, improving consistency in access control across exercises and training planning. - Bumped application version to 0.8.28 and updated changelog to reflect these changes.
This commit is contained in:
1 parent
abee6171df
commit
e0ecfe927f
10 files changed
+108
-13
No files matched your search
@@ -15,7 +15,11 @@ from fastapi import APIRouter, HTTPException, Depends, Query, UploadFile, File,
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
from db import get_db, get_cursor, r2d
|
||||
from club_tenancy import assert_valid_governance_visibility, exercise_visible_to_profile, is_platform_admin
|
||||
from club_tenancy import (
|
||||
assert_valid_governance_visibility,
|
||||
is_platform_admin,
|
||||
library_content_visible_to_profile,
|
||||
)
|
||||
from tenant_context import TenantContext, get_tenant_context, library_content_visibility_sql
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -765,7 +769,7 @@ def get_exercise(
|
||||
if not exercise:
|
||||
raise HTTPException(status_code=404, detail="Übung nicht gefunden")
|
||||
|
||||
if not exercise_visible_to_profile(
|
||||
if not library_content_visible_to_profile(
|
||||
cur,
|
||||
profile_id,
|
||||
exercise["visibility"],
|
||||
|
||||
@@ -11,8 +11,8 @@ from fastapi import APIRouter, Depends, HTTPException
|
||||
|
||||
from club_tenancy import (
|
||||
assert_valid_governance_visibility,
|
||||
exercise_visible_to_profile,
|
||||
is_platform_admin,
|
||||
library_content_visible_to_profile,
|
||||
)
|
||||
from db import get_db, get_cursor, r2d
|
||||
|
||||
@@ -44,7 +44,7 @@ def _framework_assert_readable(
|
||||
) -> None:
|
||||
if is_platform_admin(role):
|
||||
return
|
||||
if not exercise_visible_to_profile(
|
||||
if not library_content_visible_to_profile(
|
||||
cur,
|
||||
profile_id,
|
||||
row.get("visibility") or "private",
|
||||
|
||||
@@ -12,8 +12,8 @@ from db import get_db, get_cursor, r2d
|
||||
from tenant_context import TenantContext, get_tenant_context, library_content_visibility_sql
|
||||
from club_tenancy import (
|
||||
assert_valid_governance_visibility,
|
||||
exercise_visible_to_profile,
|
||||
is_platform_admin,
|
||||
library_content_visible_to_profile,
|
||||
)
|
||||
|
||||
router = APIRouter(prefix="/api", tags=["training_planning"])
|
||||
@@ -531,7 +531,7 @@ def _fetch_training_plan_template_row(cur, tid: int) -> Dict[str, Any]:
|
||||
def _template_assert_readable(cur, row: Dict[str, Any], profile_id: int, role: Optional[str]) -> None:
|
||||
if is_platform_admin(role):
|
||||
return
|
||||
if not exercise_visible_to_profile(
|
||||
if not library_content_visible_to_profile(
|
||||
cur,
|
||||
profile_id,
|
||||
row.get("visibility") or "club",
|
||||
|
||||
Reference in new issue
Block a user