basyx commited on
Commit
b892f66
·
verified ·
1 Parent(s): 3d8032f

Authorize SMS with operations scope

Browse files
Files changed (1) hide show
  1. app/security/policy.py +6 -12
app/security/policy.py CHANGED
@@ -45,9 +45,10 @@ class ScopePolicy:
45
  return "assets:write"
46
  if path.startswith("/v1/media/") and method == "GET":
47
  return "operations:read"
48
- if path.startswith(
49
- ("/v1/video", "/v1/audio", "/v1/image", "/v1/whisper", "/v1/ytdlp", "/v1/diarization")
50
- ) or path == "/v1/probe":
 
51
  return "operations:execute"
52
  if method == "GET":
53
  return "system:read"
@@ -72,18 +73,11 @@ class ScopePolicy:
72
  @staticmethod
73
  def is_job(required_scope: str | None) -> bool:
74
  return required_scope in {
75
- "templates:run",
76
- "operations:execute",
77
- "jobs:create",
78
- "mcp:execute",
79
  }
80
 
81
  @staticmethod
82
  def is_upload(request: Request, required_scope: str | None) -> bool:
83
  return request.method in {"POST", "PUT", "PATCH"} and required_scope in {
84
- "templates:run",
85
- "operations:execute",
86
- "jobs:create",
87
- "assets:write",
88
- "mcp:execute",
89
  }
 
45
  return "assets:write"
46
  if path.startswith("/v1/media/") and method == "GET":
47
  return "operations:read"
48
+ if path.startswith((
49
+ "/v1/video", "/v1/audio", "/v1/image", "/v1/whisper",
50
+ "/v1/ytdlp", "/v1/diarization", "/v1/sms"
51
+ )) or path == "/v1/probe":
52
  return "operations:execute"
53
  if method == "GET":
54
  return "system:read"
 
73
  @staticmethod
74
  def is_job(required_scope: str | None) -> bool:
75
  return required_scope in {
76
+ "templates:run", "operations:execute", "jobs:create", "mcp:execute"
 
 
 
77
  }
78
 
79
  @staticmethod
80
  def is_upload(request: Request, required_scope: str | None) -> bool:
81
  return request.method in {"POST", "PUT", "PATCH"} and required_scope in {
82
+ "templates:run", "operations:execute", "jobs:create", "assets:write", "mcp:execute"
 
 
 
 
83
  }