Skip to content

Google auth - #54

Open
DerDhaval wants to merge 55 commits into
mainfrom
google-auth
Open

Google auth#54
DerDhaval wants to merge 55 commits into
mainfrom
google-auth

Conversation

@DerDhaval

Copy link
Copy Markdown
Collaborator

What:

Why:

Please describe the tests:

  • Test 1:
  • Test 2:

Please describe the performance impact:

Code Review Checklist (to be filled out by reviewer)

  • NEW: Are there any Satellite database migrations? Are they forwards and backwards compatible?
  • Does the PR describe what changes are being made?
  • Does the PR describe why the changes are being made?
  • Does the code follow our style guide?
  • Does the code follow our testing guide?
  • Is the PR appropriately sized? (If it could be broken into smaller PRs it should be)
  • Does the new code have enough tests? (every PR should have tests or justification otherwise. Bug-fix PRs especially)
  • Does the new code have enough documentation that answers "how do I use it?" and "what does it do?"? (both source documentation and higher level, diagrams?)
  • Does any documentation need updating?
  • Do the database access patterns make sense?

princeparmar and others added 26 commits May 23, 2026 18:11
- Introduced a new table `google_backup_credentials` to store Google OAuth tokens for user backups, including fields for user ID, email, access tokens, and timestamps for creation and updates.
- Added necessary SQL commands for table creation and indexing in various database configurations.
- Updated the schema and model definitions to support the new table and its operations.

These changes enhance the application's ability to manage Google OAuth credentials securely and efficiently.
- Introduced a new `GoogleBackupCredential` struct to store Google OAuth tokens, including user ID, email, access tokens, and timestamps.
- Implemented the `GoogleBackupCredentials` interface for CRUD operations on Google backup credentials.
- Enhanced the `Service` with methods to register Google backup credentials and fetch domain users during registration.
- Updated the `socialmedia` package to support Google OAuth token management and refresh functionality.

These changes improve the application's capability to manage Google OAuth credentials for user backups effectively.
- Reintroduced `macaroon` and `uuid` imports in `apikeys.go` for enhanced API key handling.
- Removed commented code in `projects.go` for cleaner codebase.
- Updated user tier retrieval logic in `users.go` to check user kind instead of paid tier, improving clarity and functionality.
- Modified the `project` database schema to include `path_encryption` and `storage_used_percentage` fields, enhancing project management capabilities.
- Adjusted SQL commands for project creation and updates to reflect schema changes, ensuring consistency across database operations.

These changes improve the overall structure and functionality of the satellite database, facilitating better project and user management.
- Implemented `Limited_Project_Id_Project_PublicId_Project_OwnerId_By_Status_And_StatusUpdatedAt_Less_OrderBy_Asc_StatusUpdatedAt` method for retrieving project details based on status and updated timestamp with pagination support.
- Added `Delete_PushNotifications_By_Id` method to facilitate the deletion of push notifications by their ID.
- Introduced `Delete_Project_By_Id` method for removing projects from the database by their ID.

These additions enhance the satellite database's capabilities for managing projects and notifications effectively.
- Introduced `GoogleBackupCredentials` interface and related methods for managing Google OAuth tokens.
- Added validation for Google backup credentials to ensure required fields are present.
- Updated service methods to handle Google backup credential registration and auto-sync job management.
- Enhanced Swagger documentation to include new Google backup routes and their descriptions.
- Refactored existing code for improved clarity and functionality in handling Google OAuth processes.

These changes significantly enhance the application's capabilities for managing Google backup credentials and integrating with Google services.
- Deleted the `test_contract.go` file as it was no longer needed.
- Added new routes for managing Google Backup auto-sync policies, including listing, retrieving, and updating policies.
- Enhanced validation for Google Backup requests and updated Swagger documentation to reflect new API endpoints and their requirements.
- Improved the handling of Google Backup job policies in the service layer.

These changes streamline the Google Backup functionality and improve API usability.
- Added `ConnectGoogleBackupCredential` method to exchange OAuth codes for user credentials, enhancing Google Backup integration.
- Introduced `GetGoogleBackupDomainUsers` method to retrieve domain users using stored Google backup credentials.
- Updated `GoogleBackupCredentials` interface to include a method for fetching credentials by user ID and Google email.
- Created new API endpoints for connecting Google accounts and restoring data, with appropriate Swagger documentation for clarity.
- Enhanced validation and error handling for Google Backup requests, ensuring robust user experience.

These changes significantly improve the management and usability of Google Backup features within the application.
- Introduced new API endpoints for managing Google Backup auto-sync policies, including listing, retrieving, updating, and merging policies.
- Implemented validation for `UpdateGoogleBackupAutoSyncPolicyRequest` and `MergeGoogleBackupAutoSyncPoliciesRequest` to ensure correct input.
- Added comprehensive unit tests for policy validation and payload generation.
- Updated Swagger documentation to reflect new routes and request structures, enhancing API usability and clarity.

These changes significantly enhance the management of Google Backup policies within the application.
- Added detailed logging for Google OAuth token exchange requests and failures in the `GetGoogleOauthToken` function.
- Introduced helper functions to log request parameters and error responses, improving traceability and debugging capabilities.

These changes improve the observability of the Google OAuth process, aiding in troubleshooting and monitoring.
- Updated Swagger documentation for various API endpoints, including project management, bucket usage, notifications, and account settings.
- Introduced new endpoints for managing project invitations, user notifications, and payment plans.
- Improved descriptions and parameters for existing endpoints to enhance clarity and usability.
- Added detailed response models for new and existing API functionalities.

These changes significantly improve the API's documentation and usability, facilitating better integration and user experience.
- Updated onboarding process to include new parameters for tracking onboarding status and steps.
- Enhanced `ConnectGoogleBackupCredential` method to return detailed results, including granted and ungranted scopes.
- Introduced new API endpoints for preparing and starting Google Backup restores, improving user experience and integration.
- Improved validation and error handling for restore requests, ensuring robust functionality.
- Updated Swagger documentation to reflect changes in onboarding and restore processes, enhancing clarity for API users.

These changes significantly improve the onboarding experience and restore capabilities for Google Backup within the application.
- Deleted the `google_backup_onboarding_test.go` file as it was no longer needed.
- Removed legacy onboarding step constant `onboardingStepGoogleBackupCompletedLegacy` from the onboarding process.
- Updated the `GoogleBackupOnboardingStatus` function to only consider the current onboarding steps.
- Introduced a new API structure for Google Backup onboarding responses, enhancing clarity and usability.
- Updated Swagger documentation to reflect changes in onboarding processes and API responses.

These changes streamline the Google Backup onboarding functionality and improve the overall API experience.
- Introduced a new audit log service to track user activities, including actions, resources, messages, and statuses.
- Implemented methods for recording user audits in various contexts (e.g., HTTP requests, user logins).
- Created a comprehensive audit log contract document outlining the schema, status values, and action codes.
- Added new API endpoints for listing, filtering, and exporting audit logs, enhancing user traceability and compliance.
- Updated Swagger documentation to include new audit log routes and response models, improving API usability.

These changes significantly enhance the application's auditing capabilities, providing better visibility into user actions and system events.
- Introduced `Validate` method for `MergeGoogleBackupAutoSyncPoliciesRequest` to ensure at least two policy IDs are provided.
- Updated `MergeGoogleBackupAutoSyncPoliciesRequest` to use `PolicyIDs` instead of `DryRun`.
- Added new API endpoints for listing Google Backup users, groups, and job services, enhancing user management capabilities.
- Updated Swagger documentation to reflect new endpoints and improved response structures for better clarity and usability.

These changes enhance the functionality and validation of Google Backup auto-sync policies, improving the overall API experience.
…andling

- Modified the migration script for the audit_logs table to add a message column only if it does not already exist.
- Updated the script to set the message field based on the action, accounting for both empty and NULL values.
- Dropped the default value for the message column to allow for more flexible data handling.

These changes improve the integrity and usability of the audit logs by ensuring that all relevant actions are properly recorded.
- Updated the migration script for the audit_logs table to create it only if it does not already exist.
- Changed the default value for the timestamp column to current_timestamp for better accuracy.
- Added indexing for actor_id and action columns to improve query performance.
- Removed unnecessary columns actor_name and actor_email to streamline the schema.

These changes enhance the integrity and performance of the audit_logs table, ensuring efficient data handling and retrieval.
- Updated Swagger documentation for Google Backup auto-sync job endpoints, including detailed descriptions and improved parameter definitions.
- Added new response models for auto-sync job details and lists, enhancing clarity for API users.
- Refactored FCM token management endpoints to reflect changes in settings and improve user experience with push notifications.
- Introduced new settings for user notification preferences, including channel priorities and registration for FCM tokens.

These changes improve the usability and clarity of the API documentation, facilitating better integration and user experience.
- Implemented a new API endpoint to retrieve backup and restore logs, enhancing monitoring capabilities.
- Updated the service layer to handle requests for logs, including validation for session tokens.
- Enhanced Swagger documentation to include details about the new endpoint, parameters, and response models for better clarity and usability.

These changes improve the functionality and documentation of the Google Backup API, facilitating better user experience and integration.
- Removed deprecated endpoints for listing Google Backup users and groups, consolidating functionality into a new service structure.
- Introduced new endpoints for managing Google Backup users and groups, including domain retrieval and mailbox services.
- Updated Swagger documentation to reflect the new API structure, improving clarity and usability for developers.
- Enhanced validation and error handling for user and group management requests.

These changes streamline the Google Backup API, improving user management capabilities and overall documentation quality.
- Enhanced validation for `UpdateGoogleBackupAutoSyncPolicyRequest` and `CreateGoogleBackupAutoSyncPolicyRequest` to ensure required fields are present.
- Introduced new API endpoints for creating and moving Google Backup auto-sync policies, improving user management capabilities.
- Updated Swagger documentation to reflect new endpoints and improved parameter definitions for better clarity and usability.
- Refactored existing methods to streamline policy management and enhance error handling.

These changes improve the functionality and usability of the Google Backup auto-sync policies API, facilitating better integration and user experience.
…tion

- Eliminated the 'active' query parameter from the Google Backup Users & Groups API documentation across multiple files, including Swagger JSON and YAML formats.
- Updated related comments and documentation to enhance clarity and usability for developers.

These changes streamline the API documentation by removing outdated parameters, improving the overall user experience.
…ctionality

- Introduced methods for creating access grants for managed projects, including decryption of managed passphrases and retrieval of Google Backup API keys.
- Added a new endpoint for refreshing StorX tokens for Backup-Tools, improving token management and user experience.
- Updated Swagger documentation to reflect new endpoints and improved parameter definitions for better clarity and usability.
- Enhanced error handling and validation across the new functionalities.

These changes improve the Google Backup API's capabilities, facilitating better integration and user management.
…roved documentation

- Introduced new endpoints for Google Backup OAuth onboarding: `GET /auth/google-backup/init` for redirecting to Google consent and `GET /auth/google-backup/oauth-url` for retrieving the OAuth URL without redirection.
- Updated Swagger documentation to include these new endpoints, enhancing clarity on OAuth flow and parameters.
- Improved response models for restore job management, including detailed structures for job status and history.
- Refactored existing API documentation to ensure consistency and usability across all endpoints.

These changes enhance the Google Backup API's onboarding process and improve overall documentation quality, facilitating better integration and user experience.
…rmatting

- Updated the `getDashboardUsageLimits` method to utilize `GetProjectBandwidthTotals`, simplifying the bandwidth usage retrieval process.
- Refactored the `enrichUsageQuotaCard` function to use a new `formatQuotaFraction` method for displaying used and limit values, improving clarity in the quota representation.
- Introduced a helper function, `quotaExceeded`, to streamline the logic for determining if the usage exceeds the limit.

These changes enhance the readability and maintainability of the code while providing a clearer representation of bandwidth usage limits in the dashboard.
DerDhaval and others added 6 commits July 7, 2026 10:42
- Added a new endpoint `POST /google-backup/auto-sync/task/{job_id}/backup-now` to trigger on-demand backups for interval auto-sync jobs without altering the cron schedule.
- Introduced the `TriggerGoogleBackupAutoSyncBackupNow` method in `google_backup_autosync.go` to handle the backup request and validate input parameters.
- Enhanced Swagger documentation to include the new endpoint, detailing request parameters and response structures for improved API usability.
- Updated related files to ensure proper routing and response handling for the new backup functionality.

These changes enhance the backup capabilities of the Google Auto-Sync feature, providing users with more flexibility in managing their backup tasks.
- Updated the `github.com/StorXNetwork/common` dependency to version `0.0.5`.
- Introduced new mail export job features, including the creation, retrieval, claiming, and cancellation of mail export jobs.
- Enhanced the API to support mail export job management with new endpoints for internal services.
- Added database schema changes to accommodate mail export jobs, including necessary migrations and indexes.
- Implemented logic to handle non-billable internal downloads for mail export, ensuring proper bandwidth management.

These changes enhance the application's capabilities for managing mail export jobs, improving user experience and operational efficiency.
- Revised the invitation email templates for existing, new, and unverified users to improve clarity and user engagement.
- Updated text to be more inviting and user-friendly, including changes to the invitation messages and instructions.
- Enhanced the styling of email elements, including font sizes, colors, and button designs for better visual appeal.
- Introduced new content to guide users on signing in and accepting invitations, ensuring a smoother onboarding experience.

These updates aim to enhance the overall user experience during the invitation process, making it more intuitive and visually appealing.
Enhance Google Backup Restore functionality and API documentation
- Introduced `EmailOrgUnits` field in `CreateGoogleBackupAutoSyncJobsRequest` to support mapping emails to Google Admin organizational units.
- Implemented `normalizeEmailOrgUnits` and `shouldEnrichJobOrgUnits` functions to manage organizational unit paths for emails.
- Enhanced the `CreateGoogleBackupAutoSyncJobs` method to utilize organizational unit data when creating backup jobs.
- Added unit tests for new functionality, ensuring correct behavior of email normalization and organizational unit mapping.
- Updated Swagger documentation to reflect changes in API request structure and new optional parameters.

These enhancements improve the flexibility and accuracy of email handling in Google Backup Auto-Sync jobs, allowing for better integration with Google Admin organizational structures.
- Added `PolicyScope` and `OrgUnitSchedules` fields to `CreateGoogleBackupAutoSyncJobsRequest` to support per-organizational unit scheduling.
- Implemented `normalizeOrgUnitSchedules` function to clean and structure organizational unit schedule data.
- Introduced new tests for `needsScheduleInBody` and `normalizeOrgUnitSchedules` to ensure correct functionality.
- Updated Swagger documentation to include new parameters and clarify API behavior regarding organizational units.
- Enhanced existing tests to validate the integration of organizational unit handling in the auto-sync process.

These changes improve the flexibility of Google Backup Auto-Sync jobs, allowing for more granular scheduling based on organizational units.
- Introduced `Services` field in `GoogleBackupOrgUnitSchedule` and `CreateGoogleBackupAutoSyncJobsRequest` to allow specifying services for each organizational unit.
- Implemented `collectGoogleBackupServices` function to aggregate services from top-level and organizational unit schedules.
- Updated `normalizeOrgUnitSchedules` and `normalizeGoogleBackupServices` functions to handle new service requirements and validation.
- Added tests for new service handling logic, ensuring correct behavior when services are empty or specified.
- Enhanced Swagger documentation to reflect changes in API request structure and clarify service handling.

These updates improve the flexibility of Google Backup Auto-Sync jobs, allowing for more granular control over service management in organizational unit scheduling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants