Commit graph

221 commits

Author SHA1 Message Date
Max
0b88fb6098 Refactor content type assertion in file tests for improved clarity
- Adjusted the assertion for content type in the file tests to enhance readability and maintainability.
- Ensured that the content type validation remains robust while checking for variations that may include charset.
2025-11-06 11:57:59 +08:00
Max
59c32bd1f6 Update file tests to handle content type variations
- Modified assertions in file upload, retrieval, and content tests to account for content type variations that may include charset.
- Enhanced test robustness by checking that the content type starts with the expected value, improving validation accuracy.
2025-11-06 11:57:38 +08:00
Max
80d0b80a6d Refactor file permission checks to enhance access control logic
- Combined team and owner permission validation to streamline access checks for files.
- Implemented distinct validation paths for owner-only and team-only permissions, improving clarity and maintainability.
- Updated existing permission checks to ensure proper handling based on file sharing settings, enhancing security and user access management.
2025-11-06 09:44:36 +08:00
Max
5d18e76acd Enhance attachment management with public and share fields
- Introduced new fields in the attachment model for public access control and sharing options, allowing attachments to be marked as public or shared with specific teams.
- Updated the upload process to handle new permission fields, ensuring proper handling of public and share options during file uploads.
- Implemented permission checks in the file retrieval and deletion processes to enforce access control based on user roles and attachment settings.
- Added comprehensive tests for the new permission fields to validate functionality and ensure correct behavior in various scenarios.
2025-11-05 18:11:36 +08:00
Max
27d8378511 Remove unnecessary blank line in HasJobAccess function for cleaner code. 2025-11-05 14:22:40 +08:00
Max
7feb3e7c7a Enhance job and execution access control with authorization checks
- Added authorization checks in ListExecutions, GetExecution, StopExecution, and GetExecutionProgress functions to ensure users have access to the respective jobs and executions.
- Implemented similar checks in ListJobs, GetJob, StopJob, and GetJobProgress functions to validate user permissions before performing actions.
- Introduced handling for unauthorized access attempts, returning appropriate error responses for better security and user feedback.
- Updated ListLogs and ListExecutionLogs functions to include access validation for job and execution logs.
2025-11-05 14:14:57 +08:00
Max
4f8f011da7 Add Yao custom fields and enhance permission checks
- Introduced new fields in the Job struct for Yao integration, including YaoCreatedBy, YaoUpdatedBy, YaoTeamID, and YaoTenantID.
- Updated the makeJob function to utilize YaoCreatedBy for setting the CreatedBy field.
- Enhanced permission checks in various functions to validate user access to collections, ensuring proper authorization handling.
- Implemented permission validation in document handling functions to restrict access based on user roles and collection settings.
2025-11-05 11:32:07 +08:00
Max
5c2f323e64 Add permission checks for collection removal
- Implemented authorization checks in the RemoveCollection function to ensure users have the necessary permissions before removing a collection.
- Introduced error handling for unauthorized access attempts, returning appropriate responses for permission denials.
- Enhanced security by validating user access based on their authorization information.
2025-11-05 10:01:07 +08:00
Max
d6713ecddb Add permission checks for updating collection metadata
- Implemented authorization checks in the UpdateCollectionMetadata function to ensure users have the necessary permissions before making updates.
- Introduced a new checkCollectionPermission function to validate user access based on team and owner constraints.
- Enhanced error handling to return appropriate responses for unauthorized access attempts.
2025-11-05 09:48:21 +08:00
Max
f6aead62bb Refactor scope loading to dynamically retrieve first-level subdirectories
- Introduced a new function to get first-level subdirectories in the scopes directory, enhancing the flexibility of scope definition loading.
- Updated the loadScopeDefinitions method to utilize this new function, replacing hardcoded subdirectory names with a dynamic approach.
- Improved the description of the invite verification scope in the user scope initialization for clarity.
2025-11-04 18:07:22 +08:00
Max
e1405a5fa2 Update user endpoint definitions to include profile and teams retrieval
- Added new endpoints for retrieving user profile and teams in the user scope initialization.
- Ensured the existing endpoint for team selection remains included for continued functionality.
2025-11-04 17:31:33 +08:00
Max
007cf0adb9 Update token scope references in user entry and login processes
- Changed token scope from `ScopeInviteVerification` to `ScopeEntryVerification` in both `GinVerifyInvite` and `LoginByUserID` functions to align with updated authorization requirements.
- Updated error messages to reflect the new expected scope for improved clarity in responses.
2025-11-04 16:52:03 +08:00
Max
3b26873d56 Enhance environment variable processing in EntryConfig
- Added functionality to process SuccessURL, FailureURL, and LogoutRedirect fields in EntryConfig for environment variable substitution.
- Implemented checks to ensure that referenced environment variables exist, collecting any missing variables for further handling.
- Improved overall configuration handling by ensuring URLs are properly replaced with their corresponding environment variable values.
2025-11-03 08:16:41 +08:00
Max
7bbd0d08ca Refactor EndpointInfo struct initialization for improved readability
- Reformatted the initialization of the EndpointInfo struct in the ScopeManager to enhance code clarity and maintainability.
- Ensured consistent alignment of struct fields for better visual organization.
2025-10-31 20:55:23 +08:00
Max
6751136e6b Enhance scope management with deep copy functionality
- Implemented deep copy mechanisms for extra constraints and endpoint information to prevent shared state issues.
- Updated the `addEndpointRule` and `matchEndpoint` methods to utilize deep copies, ensuring data integrity during scope management.
- Added utility functions for deep copying maps and values, enhancing the robustness of the ACL system.
2025-10-31 20:32:22 +08:00
Max
6b38b76558 Add authorization checks and filtering in collection and document listing
- Integrated authorization information retrieval in `ListCollections` and `ListDocuments` functions to enhance security.
- Implemented permission-based filtering to ensure users can only access collections and documents they are authorized to view.
- Refactored query parameter construction for improved readability and maintainability.
2025-10-31 19:50:21 +08:00
Max
0eff0091a0 Update asset modification times and refactor import statements
- Updated the modification times for various assets in `bindata.go` to reflect recent changes.
- Refactored import statements in `team_invitation.go` to maintain consistency and improve code organization by moving the `utils` import to the correct position.
2025-10-31 11:13:57 +08:00
Max
d17832c016 Update asset metadata and enhance collection features in the API
- Updated the modification times for various assets in `bindata.go` to reflect recent changes.
- Enhanced the collection management in the API by adding new fields for `preset`, `public`, and `share` in the collection and document models, allowing for better control over collection visibility and sharing options.
- Updated the `CreateCollection` function to incorporate the new `share` field, improving the handling of collection data based on user permissions.
- Refactored utility functions to streamline type conversions, ensuring consistent data handling across the user and team management functionalities.
2025-10-31 11:05:46 +08:00
Max
0ee38a1cb3 Implement attachment wrapper parsing and Base64 conversion in attachment manager
- Added `Parse` function to handle attachment wrapper strings, extracting uploader name and file ID.
- Introduced `Base64` function to convert attachment wrappers to Base64 format, with optional data URI support.
- Enhanced `readFilePathAsBase64` to read files from the filesystem and return Base64 encoded content.
- Updated `teamInvitationGetPublic` to process team logos and inviter pictures as Base64 for direct display in the response.
2025-10-30 09:59:09 +08:00
Max
538f76e317 Add features query endpoint to user API
- Introduced a new endpoint `GET /features` to allow authenticated users to query available features.
- This addition enhances the user experience by providing access to feature-related information directly through the API.
2025-10-29 15:32:36 +08:00
Max
47934f87a7 Add feature manager support in ACL initialization
- Enhanced the ACL structure to include a new FeatureManager field, allowing for better management of feature-related permissions.
- Updated the New function to load the feature manager during ACL initialization, improving the overall functionality and logging success messages for better traceability.
2025-10-29 12:07:27 +08:00
Max
d7dc5dfd3f Fix error handling in invitation resend test
- Updated the `TestInvitationResend` function to properly handle errors when sending the invitation request, ensuring that any failures are reported during the test execution.
- This change improves the reliability of the test by providing clearer feedback on issues encountered during the invitation process.
2025-10-29 09:52:57 +08:00
Max
481a6edbd5 Enhance team invitation functionality with locale support
- Updated the invitation resend process to accept a locale parameter, allowing for locale-specific email formatting and invitation link generation.
- Modified the `teamInvitationResend` function to include locale handling, ensuring proper configuration based on the user's locale.
- Enhanced the `toString` utility function to support time formatting based on locale, improving date presentation in emails.
- Added new utility functions for locale-specific time formatting, ensuring consistent user experience across different regions.
- Expanded tests to validate the new locale handling in invitation processes, ensuring comprehensive coverage for various scenarios.
2025-10-29 09:28:55 +08:00
Max
7549a890e5 Refactor team configuration tests to remove uploader and avatar agent assertions
- Removed assertions for the uploader and avatar agent fields in the team configuration tests, as these fields are no longer preserved in the public configuration.
- Updated the GetTeamConfigPublic function to reflect the changes in the TeamConfig structure, ensuring only relevant fields are included in the public configuration.
- Adjusted test cases to maintain coverage while aligning with the updated configuration structure.
2025-10-28 17:22:44 +08:00
Max
376befc21b Add Yao member profile support in OIDC user info
- Enhanced the OIDC user info structure to include Yao member profile information, such as member ID, display name, bio, avatar, and email.
- Updated the SignIDToken and MakeOIDCUserInfo functions to incorporate member details if available, improving team context handling.
- Refactored the issueTokens function to accept a new IssueTokensParams structure, streamlining token issuance with team and member context.
- Adjusted login functions to retrieve and pass member profile data during token issuance, ensuring comprehensive user context in authentication flows.
2025-10-28 16:55:06 +08:00
Max
bf452ba1d3 Add member profile retrieval functionality
- Introduced a new endpoint `GET /teams/:team_id/members/:member_id/profile` to allow users to retrieve member profile information, including display name, bio, avatar, and email.
- Implemented the `GinMemberGetProfile` handler to process profile retrieval requests with appropriate authentication and error handling.
- Added business logic in `memberGetProfile` to ensure only authenticated users can access their own profile data.
- Expanded test cases in `TestMemberProfileGet` to validate various scenarios for profile retrieval, ensuring comprehensive coverage for authentication and data validation.
2025-10-28 16:18:52 +08:00
Max
af02a21f65 Implement member profile update functionality
- Added a new endpoint `PUT /teams/:team_id/members/:member_id/profile` to allow members to update their profile information, including display name, bio, avatar, and email.
- Introduced `UpdateMemberProfileRequest` structure to handle profile update requests.
- Enhanced the `GinMemberUpdateProfile` handler to process profile updates with appropriate validation and error handling.
- Implemented business logic in `memberUpdateProfile` to ensure only the member can update their own profile.
- Expanded test cases to validate the new profile update functionality, ensuring comprehensive coverage for various update scenarios.
2025-10-28 11:49:01 +08:00
Max
b2c7ddde19 Add new endpoint for file content retrieval
- Introduced a new API endpoint `GET /file/:uploaderID/:fileID/content` to facilitate the retrieval of file content based on uploader ID and file ID.
- This addition enhances the user capabilities for accessing file data within the application.
2025-10-28 09:28:05 +08:00
Max
8ffa767dfe Add logo support to team creation and update functionality
- Enhanced the team creation and update processes to include an optional logo field, allowing teams to have custom logos.
- Updated the CreateTeamRequest and UpdateTeamRequest structures to accommodate the new logo field.
- Modified the GinTeamCreate and GinTeamUpdate handlers to handle logo data appropriately.
- Expanded test cases for team creation and updates to validate logo handling, ensuring comprehensive coverage for scenarios involving logos.
2025-10-27 17:46:25 +08:00
Max
7572f99ba0 Enhance robot member functionality with avatar support
- Added avatar field to CreateRobotMemberRequest and UpdateRobotMemberRequest structures, allowing for avatar URL or file ID during member creation and updates.
- Updated GinMemberCreateRobot and GinMemberUpdateRobot handlers to process avatar information, ensuring it is included in the member data.
- Expanded test cases for member creation and updates to validate avatar handling, including scenarios for updating only the avatar without affecting other fields.
- Enhanced team configuration tests to verify preservation of uploader and avatar agent fields, improving overall test coverage and reliability.
2025-10-27 16:45:10 +08:00
Max
26b690246d Refactor test case for member update to remove unnecessary whitespace
- Cleaned up the `TestMemberUpdateRobot` function by removing redundant blank lines, improving code readability and maintainability.
2025-10-27 13:43:27 +08:00
Max
1e01ed768e Implement robot member update functionality with comprehensive validation
- Added the `UpdateRobotMember` method to handle updates for robot members, including validation for member existence, type checks, and email uniqueness.
- Introduced a new `UpdateRobotMemberRequest` structure to facilitate updates via the API, allowing for modifications to various fields such as `robot_email`, `status`, and `autonomous_mode`.
- Enhanced the `GinMemberUpdateRobot` handler to process update requests, ensuring proper authentication and error handling for various scenarios.
- Expanded test coverage with new test cases for the robot member update functionality, validating successful updates, error conditions, and edge cases.
- Refactored existing member management logic to integrate the new update capabilities, improving overall system robustness and user experience.
2025-10-27 12:05:11 +08:00
Max
7de562f80d Update robot member functionality with new fields and validation
- Introduced the `robot_email`, `authorized_senders`, and `email_filter_rules` fields to the robot member model, enhancing the configuration options for robot members.
- Updated the member creation and existence check logic to ensure the uniqueness of `robot_email` globally, improving data integrity.
- Refactored API endpoints and request/response structures to accommodate the new fields, ensuring consistency across the member management system.
- Enhanced test cases to validate the new robot member features, including scenarios for email uniqueness and configuration updates, improving overall test coverage and reliability.
2025-10-27 11:34:07 +08:00
Max
772c00e095 Enhance member listing functionality with advanced filtering and sorting
- Introduced a new MemberListRequest structure to support advanced filtering options such as status, member_type, role_id, email, and display_name.
- Updated the GinMemberList handler to parse and validate query parameters, improving user experience with clearer error messages for invalid inputs.
- Enhanced the memberList function to handle advanced filtering and sorting, allowing for more flexible and efficient member retrieval.
- Added comprehensive test cases to validate new filtering and sorting functionalities, ensuring robust coverage and reliability in member listing scenarios.
- Refactored existing member response structures to include new fields and improve data representation.
2025-10-26 14:10:04 +08:00
Max
420a17f844 Enhance member model and team management with is_owner field
- Added the is_owner field to the member model to indicate if a member is the team owner, improving clarity and performance for queries related to team ownership.
- Updated the team creation process to automatically set the is_owner field for the creator of the team, ensuring accurate member status upon creation.
- Refactored related tests to verify the correct assignment of the is_owner field, enhancing test coverage and reliability in team membership scenarios.
- Removed redundant permission and restriction fields from the member model to streamline the data structure and improve maintainability.
2025-10-26 12:25:15 +08:00
Max
40b0c449f1 Enhance robot member creation with additional fields
- Added new fields to the robot member creation process, including permissions, restrictions, notes, and metadata, to improve the flexibility and detail of robot member configurations.
- Updated the AddMember function to include tracking of the user who invited the member and the team ID, enhancing member management and accountability.
- These changes improve the overall functionality and usability of the member management system.
2025-10-26 11:31:50 +08:00
Max
f71ce2ac9a Implement existence checks for various entities in update functions
- Added functions to check the existence of invitation codes, members, OAuth accounts, roles, teams, and user types before performing updates, enhancing error handling and user feedback.
- Updated relevant update functions to utilize these existence checks, ensuring accurate error messages when no changes are made or when entities do not exist.
- Refactored tests to validate the new existence check logic, improving overall test coverage and reliability.
2025-10-26 11:09:07 +08:00
Max
5f6f8d7911 Enhance member management with member_id and email checks
- Introduced member_id as a unique identifier for members, improving data integrity and consistency across member operations.
- Updated member-related functions to utilize member_id instead of internal IDs, enhancing API usability and clarity.
- Implemented email existence checks for team members, allowing for better validation during member creation and updates.
- Refactored existing tests to accommodate changes in member identification and email validation, ensuring comprehensive coverage and reliability.
- Added new API endpoint for checking if an email exists within a team, improving user experience during member management.
2025-10-26 09:49:45 +08:00
Max
fd10a058b1 Implement robot member creation and validation
- Introduced a new endpoint for creating robot members, enhancing the member model to include fields specific to robots such as email, system prompt, and autonomous mode.
- Refactored existing member creation logic to accommodate robot-specific requirements and ensure email uniqueness within teams.
- Updated request and response structures to support the new robot member functionality, improving API consistency.
- Added comprehensive test cases to validate the new robot member creation process, including scenarios for required fields, duplicate emails, and invalid inputs.
2025-10-26 09:04:22 +08:00
Max
f89dbc2109 Update member model and robot member handling
- Enhanced the member model by adding 'avatar' and updating 'display_name' and 'bio' fields for improved identity representation.
- Refactored robot member creation and validation to utilize the new fields, ensuring consistency across user and robot profiles.
- Updated test cases to reflect changes in member data structure, improving coverage and accuracy in robot member operations.
- Adjusted database indices and constraints to accommodate new fields and ensure efficient querying.
2025-10-25 17:41:30 +08:00
Max
b5812a7f2f Add Neo loading in test preparation
- Integrated Neo loading in the Prepare function of testutils.go to ensure the Neo environment is initialized before running tests.
- Updated error handling to log failures in loading Neo, enhancing test reliability and feedback.
- Adjusted variable assignment for Knowledge Base loading to maintain consistency in error handling.
2025-10-25 16:43:28 +08:00
Max
d8f267694d Refactor API handler functions for assistants in Neo package
- Updated the assistant-related API handler functions in neo/api.go to follow Go naming conventions by capitalizing the function names, making them exported for use in openapi/agent.
- This change enhances code readability and consistency across the API implementation.
- Added new LLM and MCP server management handlers in their respective packages, improving the overall structure and organization of the OpenAPI module.
- Removed the obsolete agent.go file, streamlining the codebase.
2025-10-25 16:02:01 +08:00
Max
0abb8c7d3b Update user status in test cases from "enabled" to "active"
- Modified the user creation functions in entry_test.go and invitation_test.go to use "active" as the status value instead of "enabled", aligning with the valid enum values for user status.
- This change ensures consistency across user-related tests and improves clarity regarding user status representation.
2025-10-25 14:59:57 +08:00
Max
ddf8fd7a32 Refactor test utilities and enhance access token handling
- Introduced ObtainAccessTokenWithRootPermission function to streamline the creation of test users with root permissions, ensuring consistent access token generation for tests.
- Updated various test cases to utilize the new function, improving clarity and reducing redundancy in access token acquisition.
- Enhanced team configuration retrieval to expose public settings while hiding sensitive information, improving security in API responses.
2025-10-25 13:26:51 +08:00
Max
f31b3f5882 Update member model to include profile fields and enhance invitation handling
- Added display_name, bio, and email fields to the member model for improved team-specific identity.
- Updated team invitation creation and acceptance logic to handle new profile fields, ensuring proper data management and user experience.
- Implemented logic to copy user profile fields when creating or updating members, enhancing data consistency.
2025-10-23 19:40:29 +08:00
Max
b9e71823ca Add current team retrieval endpoint and refactor team access checks 2025-10-23 17:50:32 +08:00
Max
5d6f346601 Update team invitation handling and user invitation acceptance logic
- Refactored the team invitation creation function to utilize the new authorized package for improved user authentication checks.
- Enhanced the invitation acceptance logic to include the user ID of the person who updated the invitation, improving tracking and accountability.
- Adjusted the invitation data preparation to incorporate user-specific scopes, ensuring proper permissions are applied during invitation processing.
2025-10-23 11:22:10 +08:00
Max
976eb2769d Refactor test case structure for path matching in ACL tests
- Adjusted the formatting of the test case struct in scope_test.go for improved readability.
- No functional changes were made; this commit focuses on code style consistency.
2025-10-23 10:54:48 +08:00
Max
cd9c52fe33 Normalize request paths in ACL checks and add path normalization utility
- Implemented path normalization in the ACL enforcement logic to ensure consistent matching by removing trailing slashes from request paths.
- Introduced a new utility function, normalizePath, to handle path normalization across various components.
- Updated endpoint matching and public endpoint checks to utilize the normalized paths, improving access decision accuracy.
- Enhanced team and member creation logic to include a new field, __yao_team_id, for better data management.
2025-10-23 10:48:53 +08:00
Max
cc181a52f6 Enhance ACL configuration and enforcement with path prefix support
- Updated ACL configuration to include a PathPrefix field, allowing for dynamic path stripping from request URLs.
- Enhanced ACL enforcement logic to log the configured path prefix and adjust request paths accordingly during access checks.
- Improved logging throughout the enforcement process to provide clearer insights into access decisions and scope matching.
- Registered built-in scopes for temporary access tokens, enhancing flexibility in access control for specific endpoints.
- Updated scope management to support constraints for matched scopes, improving granularity in access control configurations.
2025-10-22 19:19:30 +08:00