snow-flow 2.9.7 → 2.9.8

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.
@@ -206,13 +206,15 @@ class DeploymentAuthManager {
206
206
  return response.status === 200;
207
207
  }
208
208
  catch (error) {
209
- // 403 means we don't have permission
209
+ // Only treat 403 as definitive no permission
210
210
  if (error.response?.status === 403) {
211
- logger.warn('No write permissions for Service Portal');
211
+ logger.warn('403 Forbidden: No write permissions for Service Portal');
212
212
  return false;
213
213
  }
214
- // Other errors we'll assume no permission
215
- return false;
214
+ // For other errors (network, timeout, 500, etc.) assume permissions are OK
215
+ // since an admin account should have access
216
+ logger.warn(`Permission check failed with non-403 error (${error.response?.status || 'no status'}), assuming permissions OK for admin account:`, error.message);
217
+ return true; // Changed from false to true - be less restrictive
216
218
  }
217
219
  }
218
220
  /**
@@ -543,14 +543,30 @@ class ServiceNowClient {
543
543
  if (roleTest?.status && typeof roleTest.status === 'string' && roleTest.status.includes('PASS')) {
544
544
  const roles = roleTest.result?.roles;
545
545
  if (Array.isArray(roles)) {
546
+ // Debug: Log actual roles for troubleshooting
547
+ this.logger.info(`User roles found: ${roles.join(', ')}`);
546
548
  const hasRequiredRole = roles.some((role) => {
547
549
  if (typeof role === 'string') {
548
- return role.includes('admin') || role.includes('sp_portal');
550
+ const roleLower = role.toLowerCase();
551
+ // Check for admin roles: admin, system_administrator, etc.
552
+ const isAdmin = roleLower.includes('admin');
553
+ // Check for portal manager roles: sp_portal_manager, sp_admin, etc.
554
+ const isPortalManager = roleLower.includes('sp_portal_manager') ||
555
+ roleLower.includes('sp_admin') ||
556
+ roleLower.includes('portal_manager');
557
+ if (isAdmin || isPortalManager) {
558
+ this.logger.info(`✅ Found qualifying role: ${role}`);
559
+ }
560
+ return isAdmin || isPortalManager;
549
561
  }
550
562
  return false;
551
563
  });
552
564
  if (!hasRequiredRole) {
553
- recommendations.push('⚠️ User lacks admin or portal management roles. Contact ServiceNow admin to assign appropriate roles');
565
+ this.logger.warn(`❌ No qualifying roles found in: ${roles.join(', ')}`);
566
+ recommendations.push(`⚠️ User roles (${roles.join(', ')}) don't include admin or portal management roles. Contact ServiceNow admin to assign appropriate roles`);
567
+ }
568
+ else {
569
+ this.logger.info('✅ User has sufficient roles for deployment');
554
570
  }
555
571
  }
556
572
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "2.9.7",
3
+ "version": "2.9.8",
4
4
  "description": "Snow-Flow: ServiceNow Advanced Intelligence Platform - 100+ real MCP tools with AI-powered swarm orchestration and neural networks. Dynamic task categorization using AI. Machine learning for incident classification, change risk prediction, and anomaly detection. Zero Mock Data, 100% Real API Integration.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",