yirifi-ops-auth-client 3.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,80 @@
1
+ """Data models for auth client."""
2
+ from dataclasses import dataclass, field
3
+ from typing import Optional
4
+
5
+
6
+ @dataclass
7
+ class AuthUser:
8
+ """Authenticated user information with RBAC support."""
9
+
10
+ user_id: str # Immutable UUID, use for storage in domain tables
11
+ id: int # Internal ID (kept for backward compatibility)
12
+ email: str
13
+ display_name: str
14
+ is_admin: bool # deprecated - use has_permission() instead
15
+ microsites: list[str]
16
+
17
+ # RBAC fields
18
+ roles: list[str] = field(default_factory=list)
19
+ permissions: list[str] = field(default_factory=list)
20
+ effective_role: Optional[str] = None
21
+
22
+ def has_access_to(self, microsite_id: str) -> bool:
23
+ """Check if user has access to a microsite."""
24
+ return microsite_id in self.microsites
25
+
26
+ def has_permission(self, permission: str) -> bool:
27
+ """Check if user has a specific permission.
28
+
29
+ Args:
30
+ permission: Permission code (e.g., 'report:create')
31
+
32
+ Returns:
33
+ True if user has the permission
34
+ """
35
+ return permission in self.permissions
36
+
37
+ def has_role(self, role: str) -> bool:
38
+ """Check if user has a specific role.
39
+
40
+ Args:
41
+ role: Role code (e.g., 'editor')
42
+
43
+ Returns:
44
+ True if user has the role
45
+ """
46
+ return role in self.roles
47
+
48
+ def has_any_permission(self, *permissions: str) -> bool:
49
+ """Check if user has any of the specified permissions.
50
+
51
+ Args:
52
+ *permissions: Permission codes to check
53
+
54
+ Returns:
55
+ True if user has at least one of the permissions
56
+ """
57
+ return any(p in self.permissions for p in permissions)
58
+
59
+ def has_all_permissions(self, *permissions: str) -> bool:
60
+ """Check if user has all of the specified permissions.
61
+
62
+ Args:
63
+ *permissions: Permission codes to check
64
+
65
+ Returns:
66
+ True if user has all of the permissions
67
+ """
68
+ return all(p in self.permissions for p in permissions)
69
+
70
+
71
+ @dataclass
72
+ class VerifyResult:
73
+ """Result from auth verification."""
74
+
75
+ valid: bool
76
+ user: Optional[AuthUser] = None
77
+ error: Optional[str] = None
78
+ redirect_url: Optional[str] = None
79
+ has_access: bool = True
80
+ role: Optional[str] = None # deprecated - use user.effective_role instead
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: yirifi-ops-auth-client
3
+ Version: 3.2.3
4
+ Summary: Authentication client library for Yirifi Ops microsites with RBAC support
5
+ Requires-Python: >=3.10
6
+ Requires-Dist: httpx>=0.27
7
+ Requires-Dist: flask>=2.0
8
+ Requires-Dist: sqlalchemy>=2.0.45
9
+ Provides-Extra: yaml
10
+ Requires-Dist: pyyaml>=6.0; extra == "yaml"
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=8.0; extra == "dev"
13
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
14
+ Requires-Dist: responses>=0.24; extra == "dev"
15
+ Requires-Dist: pyyaml>=6.0; extra == "dev"
@@ -0,0 +1,19 @@
1
+ yirifi_ops_auth/__init__.py,sha256=uy3QK_KyZ3crKgtT5P7MqBGYFEh3hzf7Dt68VAn0rsE,1457
2
+ yirifi_ops_auth/client.py,sha256=zQIsDB8MadIf5PDhZKOI8yflYEV95f6NprmCDpZDv0o,5649
3
+ yirifi_ops_auth/decorators.py,sha256=PZvrYJ_SgIjHhPVY1tOpuL72rxgIg2i5zgSe7AnkpGY,6418
4
+ yirifi_ops_auth/exceptions.py,sha256=8hQhoQKumhRCWmZB8XPQMT9ThqocnqM2jRhpetP6Z2U,923
5
+ yirifi_ops_auth/local_user.py,sha256=cyFNeEFBeR4wBPHJhrfLHwOn-gtCV-ysQNLr-B2qc4A,3713
6
+ yirifi_ops_auth/middleware.py,sha256=KMSf_kZTDT1ItGaSHw7NV-jzL68PwsUGWaVi6mR5X_8,10593
7
+ yirifi_ops_auth/models.py,sha256=1qX8kVeUpRpjj-mN69jXn6hobX9N-KXq1NfK3GCQ8WQ,2326
8
+ yirifi_ops_auth/deeplink/__init__.py,sha256=R5GF-Sr78cdiEoinOOygBX2-CxnVfsa3wfAg0Xrsvlo,5772
9
+ yirifi_ops_auth/deeplink/blueprint.py,sha256=6rLFdoudJWCMc5xi0cZeWKV3dmhTWmaK8dy-QETgNlw,4605
10
+ yirifi_ops_auth/deeplink/environment.py,sha256=am1NlSDyje8lrwer9TdyqcPyR8iQlx4vBhOpHcxVISA,4479
11
+ yirifi_ops_auth/deeplink/federation.py,sha256=MnTftYEtgRA01yf4NDp_XZ3cqT_9G5XuJkVSJPqmpxk,13591
12
+ yirifi_ops_auth/deeplink/jinja.py,sha256=FaziyBzqm8b65hoCakO3yH8eZWpJAr5O3soafSpS1JA,11265
13
+ yirifi_ops_auth/deeplink/registry.py,sha256=vgDvQawobmTAoorDV8wjHzhLKEqBXjC-9JszWyJGB9o,12486
14
+ yirifi_ops_auth/deeplink/resolver.py,sha256=tZJsiJczNt-EdafKF_WdHcJ-Od0Ie-gLkEyNpZgjoJI,6340
15
+ yirifi_ops_auth/deeplink/yaml_loader.py,sha256=Nj2Oywr_ISJuAnadUBMWolcAGq_DxvR44VYNTQzFQkI,6928
16
+ yirifi_ops_auth_client-3.2.3.dist-info/METADATA,sha256=1Z_CiwvQFaFxDRZfMiCWppdoyzTbg1RHt1iyZqRbl0I,525
17
+ yirifi_ops_auth_client-3.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ yirifi_ops_auth_client-3.2.3.dist-info/top_level.txt,sha256=yclAYwZIF30ir5Gh_iNoRetLESkHocnPV6yOCRxb2E8,16
19
+ yirifi_ops_auth_client-3.2.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ yirifi_ops_auth