trovesuite 1.0.11__tar.gz → 1.0.12__tar.gz

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.
Files changed (42) hide show
  1. {trovesuite-1.0.11/src/trovesuite.egg-info → trovesuite-1.0.12}/PKG-INFO +1 -1
  2. {trovesuite-1.0.11 → trovesuite-1.0.12}/pyproject.toml +2 -2
  3. {trovesuite-1.0.11 → trovesuite-1.0.12}/setup.py +1 -1
  4. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/auth/auth_service.py +37 -18
  5. {trovesuite-1.0.11 → trovesuite-1.0.12/src/trovesuite.egg-info}/PKG-INFO +1 -1
  6. {trovesuite-1.0.11 → trovesuite-1.0.12}/LICENSE +0 -0
  7. {trovesuite-1.0.11 → trovesuite-1.0.12}/MANIFEST.in +0 -0
  8. {trovesuite-1.0.11 → trovesuite-1.0.12}/README.md +0 -0
  9. {trovesuite-1.0.11 → trovesuite-1.0.12}/requirements.txt +0 -0
  10. {trovesuite-1.0.11 → trovesuite-1.0.12}/setup.cfg +0 -0
  11. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/__init__.py +0 -0
  12. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/auth/__init__.py +0 -0
  13. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/auth/auth_base.py +0 -0
  14. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/auth/auth_controller.py +0 -0
  15. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/auth/auth_read_dto.py +0 -0
  16. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/auth/auth_write_dto.py +0 -0
  17. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/configs/__init__.py +0 -0
  18. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/configs/database.py +0 -0
  19. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/configs/logging.py +0 -0
  20. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/configs/settings.py +0 -0
  21. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/entities/__init__.py +0 -0
  22. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/entities/health.py +0 -0
  23. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/entities/sh_response.py +0 -0
  24. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/notification/__init__.py +0 -0
  25. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/notification/notification_base.py +0 -0
  26. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/notification/notification_controller.py +0 -0
  27. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/notification/notification_read_dto.py +0 -0
  28. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/notification/notification_service.py +0 -0
  29. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/notification/notification_write_dto.py +0 -0
  30. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/storage/__init__.py +0 -0
  31. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/storage/storage_base.py +0 -0
  32. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/storage/storage_controller.py +0 -0
  33. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/storage/storage_read_dto.py +0 -0
  34. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/storage/storage_service.py +0 -0
  35. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/storage/storage_write_dto.py +0 -0
  36. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/utils/__init__.py +0 -0
  37. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite/utils/helper.py +0 -0
  38. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite.egg-info/SOURCES.txt +0 -0
  39. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite.egg-info/dependency_links.txt +0 -0
  40. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite.egg-info/not-zip-safe +0 -0
  41. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite.egg-info/requires.txt +0 -0
  42. {trovesuite-1.0.11 → trovesuite-1.0.12}/src/trovesuite.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trovesuite
3
- Version: 1.0.11
3
+ Version: 1.0.12
4
4
  Summary: TroveSuite services package providing authentication, authorization, notifications, Azure Storage, and other enterprise services for TroveSuite applications
5
5
  Home-page: https://dev.azure.com/brightgclt/trovesuite/_git/packages
6
6
  Author: Bright Debrah Owusu
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "trovesuite"
7
- version = "1.0.11"
7
+ version = "1.0.12"
8
8
  description = "TroveSuite services package providing authentication, authorization, notifications, Azure Storage, and other enterprise services for TroveSuite applications"
9
9
  authors = ["brightgclt <brightgclt@gmail.com>"]
10
10
  license = "MIT"
@@ -58,7 +58,7 @@ Documentation = "https://dev.azure.com/brightgclt/trovesuite/_git/packages"
58
58
 
59
59
  [project]
60
60
  name = "trovesuite"
61
- version = "1.0.11"
61
+ version = "1.0.12"
62
62
  description = "TroveSuite services package providing authentication, authorization, notifications, Azure Storage, and other enterprise services for TroveSuite applications"
63
63
  readme = "README.md"
64
64
  license = {text = "MIT"}
@@ -15,7 +15,7 @@ with open("pyproject.toml", "r", encoding="utf-8") as fh:
15
15
 
16
16
  setup(
17
17
  name="trovesuite",
18
- version="1.0.11",
18
+ version="1.0.12",
19
19
  author="Bright Debrah Owusu",
20
20
  author_email="owusu.debrah@deladetech.com",
21
21
  description="TroveSuite services package providing authentication, authorization, notifications, and other enterprise services for TroveSuite applications",
@@ -77,7 +77,7 @@ class AuthService:
77
77
  )
78
78
 
79
79
  if not is_tenant_verified or len(is_tenant_verified) == 0:
80
- logger.warning("Login failed - tenant not found: %s", tenant_id)
80
+ logger.warning("Authorization failed - tenant not found: %s", tenant_id)
81
81
  return Respons[AuthServiceReadDto](
82
82
  detail=f"Tenant '{tenant_id}' not found or has been deleted",
83
83
  data=[],
@@ -87,7 +87,7 @@ class AuthService:
87
87
  )
88
88
 
89
89
  if not is_tenant_verified[0]['is_verified']:
90
- logger.warning("Login failed - tenant not verified for user: %s, tenant: %s", user_id, tenant_id)
90
+ logger.warning("Authorization failed - tenant not verified for user: %s, tenant: %s", user_id, tenant_id)
91
91
  return Respons[AuthServiceReadDto](
92
92
  detail=f"Tenant '{tenant_id}' is not verified. Please contact your administrator.",
93
93
  data=[],
@@ -146,35 +146,54 @@ class AuthService:
146
146
  error="USER_SUSPENDED"
147
147
  )
148
148
 
149
+ # ✅ UPDATED: Mutually exclusive login restrictions logic
149
150
  if not login_settings_details[0]['can_always_login']:
150
- current_day = datetime.now().strftime("%A").upper()
151
+ # Get from database (should already be datetime objects)
152
+ login_on = login_settings_details[0]['login_on']
153
+ logout_on = login_settings_details[0]['logout_on']
154
+ working_days = login_settings_details[0]['working_days']
151
155
 
152
- if current_day not in login_settings_details[0]['working_days']:
153
- logger.warning("Authorization failed - outside working days for user: %s checking custom login period", user_id)
156
+ # Only ONE restriction type can be active at a time:
157
+ # 1. working_days restriction (if login_on/logout_on are NULL)
158
+ # 2. time period restriction (if login_on/logout_on are set)
154
159
 
155
- # Get current datetime (full date and time) with timezone
156
- current_datetime = datetime.now(timezone.utc).replace(microsecond=0, second=0)
157
-
158
- # Get from database (should already be datetime objects)
159
- login_on = login_settings_details[0]['login_on']
160
- logout_on = login_settings_details[0]['logout_on']
160
+ if login_on and logout_on:
161
+ # Time period restriction is active
162
+ logger.info(f"Checking time period restriction for user: {user_id}")
161
163
 
162
- # Set defaults if None (with timezone awareness)
163
- if not login_on:
164
- login_on = datetime.min.replace(tzinfo=timezone.utc)
165
- if not logout_on:
166
- logout_on = datetime.max.replace(tzinfo=timezone.utc)
164
+ # Get current datetime (full date and time) with timezone
165
+ current_datetime = datetime.now(timezone.utc).replace(
166
+ microsecond=0, second=0
167
+ )
167
168
 
168
169
  # Compare full datetime objects (both date and time)
169
170
  if not (login_on <= current_datetime <= logout_on):
170
- logger.warning("Authorization failed - outside allowed period for user: %s", user_id)
171
+ logger.warning(
172
+ f"Authorization failed - outside allowed period for user: {user_id}"
173
+ )
171
174
  return Respons[AuthServiceReadDto](
172
- detail="Login is not allowed at this time. Please check your access schedule.",
175
+ detail="Access is not allowed at this time. Please check your access schedule.",
173
176
  data=[],
174
177
  success=False,
175
178
  status_code=403,
176
179
  error="LOGIN_TIME_RESTRICTED"
177
180
  )
181
+ elif working_days:
182
+ # Working days restriction is active
183
+ logger.info(f"Checking working days restriction for user: {user_id}")
184
+ current_day = datetime.now().strftime("%A").upper()
185
+
186
+ if current_day not in working_days:
187
+ logger.warning(
188
+ f"Authorization failed - not a working day for user: {user_id}"
189
+ )
190
+ return Respons[AuthServiceReadDto](
191
+ detail="Access is not allowed on this day. Please contact your administrator.",
192
+ data=[],
193
+ success=False,
194
+ status_code=403,
195
+ error="LOGIN_DAY_RESTRICTED"
196
+ )
178
197
 
179
198
  # 4️⃣ Build query dynamically to include groups (if any) + user
180
199
  # ⚠️ CHANGED: Simplified to new schema - only select user_id, group_id, role_id, resource_type
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trovesuite
3
- Version: 1.0.11
3
+ Version: 1.0.12
4
4
  Summary: TroveSuite services package providing authentication, authorization, notifications, Azure Storage, and other enterprise services for TroveSuite applications
5
5
  Home-page: https://dev.azure.com/brightgclt/trovesuite/_git/packages
6
6
  Author: Bright Debrah Owusu
File without changes
File without changes
File without changes
File without changes