Skip to content

Commit 0f181ed

Browse files
committed
Added org check details
1 parent 8af0aad commit 0f181ed

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.2.17"
9+
version = "2.2.18"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.2.17'
2+
__version__ = '2.2.18'
33
USER_AGENT = f'SocketPythonCLI/{__version__}'

socketsecurity/socketcli.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,27 @@ def main_code():
9898
sys.exit(3)
9999

100100
log.info(f"All required dependencies found: {', '.join(found_deps)}")
101+
102+
# Check if organization has an enterprise plan
103+
log.info("Checking organization plan for reachability analysis eligibility...")
104+
org_response = sdk.org.get(use_types=True)
105+
organizations = org_response.get("organizations", {})
106+
107+
if organizations:
108+
org_id = next(iter(organizations))
109+
org_plan = organizations[org_id].get('plan', '')
110+
111+
# Check if plan matches enterprise* pattern (enterprise, enterprise_trial, etc.)
112+
if not org_plan.startswith('enterprise'):
113+
log.error(f"Reachability analysis is only available for enterprise plans.")
114+
log.error(f"Your organization plan is: {org_plan}")
115+
log.error("Please upgrade to an enterprise plan to use reachability analysis.")
116+
sys.exit(3)
117+
118+
log.info(f"Organization plan verified: {org_plan}")
119+
else:
120+
log.error("Unable to retrieve organization information for plan verification.")
121+
sys.exit(3)
101122

102123
# Parse files argument
103124
try:

0 commit comments

Comments
 (0)