Skip to content

Refactory/bucketsetting#45

Merged
overtrue merged 6 commits intomainfrom
refactory/bucketsetting
Jan 29, 2026
Merged

Refactory/bucketsetting#45
overtrue merged 6 commits intomainfrom
refactory/bucketsetting

Conversation

@cxymds
Copy link
Copy Markdown
Member

@cxymds cxymds commented Jan 29, 2026

📝 Pull Request

📋 Description

This PR addresses two main issues:

  1. Fixes the automatic translation script (translate-locales.js):

    • Resolved fetch is not defined error in Node.js 16 environments by adding a polyfill.
    • Improved translation logic to identify and re-translate keys that were previously just placeholders (values identical to English).
    • Added rate limiting (200ms delay) to prevent triggering Google Translate API rate limits.
  2. Refines Bucket Permission Control:

    • Updated pages/buckets/[key].vue to move from a coarse isAdmin check to a fine-grained permission model using usePermissions.
    • Now supports three levels of access:
      • Super Admin (isAdmin): Full access.
      • Console Admin (consoleAdmin policy): Full access via policy.
      • Specific Permissions: Users with specific console:BucketLifecycle, console:BucketReplication, or console:BucketEvents permissions can now access the respective tabs.

🔄 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Code refactoring
  • ⚡ Performance improvement
  • 🧪 Test improvements
  • 🔒 Security fix

🧪 Testing

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • Performance tests added/updated
  • Manual testing completed

Test Results

  1. Translation Script:

    • Ran node translate-locales.js successfully in Node.js 16 environment.
    • Verified that placeholder keys in zh-CN, ja-JP, etc., were correctly identified and translated.
  2. Permission Control:

    • Verified code logic in pages/buckets/[key].vue ensures hasPermission is called for Lifecycle, Replication, and Events tabs.
    • Confirmed hasPermission correctly handles isAdmin, consoleAdmin, and specific scope grants.

Result

image image
# Lint check passed
pnpm lint:fix

📊 Performance Impact

  • No performance impact
  • Performance improved
  • Performance impact analyzed and acceptable
  • Performance benchmarks included

🔒 Security Considerations

  • No security impact
  • Security review completed
  • Vulnerability assessment done
  • Security tests added

Note: This change improves security compliance by enforcing the Principle of Least Privilege (PoLP) in the UI, allowing non-admin users to manage specific bucket features if granted explicit permission.

📚 Documentation

  • Code comments updated
  • README updated (if needed)
  • API documentation updated (if needed)
  • Changelog updated

✅ Checklist

Code Quality

  • Code follows the project's style guidelines
  • Self-review of the code completed
  • Code is properly commented
  • No console.log or debug statements left
  • TypeScript types are properly defined
  • All commit messages are in English (following Conventional Commits)

Testing

  • All existing tests pass
  • New tests cover the changes
  • Test coverage is maintained or improved
  • Edge cases are tested (e.g., Node 16 environment for script)

Dependencies

  • No new dependencies added, or they are justified
  • Dependencies are up to date
  • No security vulnerabilities in dependencies

Compatibility

  • Changes are backward compatible
  • Browser compatibility maintained
  • Node.js version compatibility maintained

🔗 Related Issues

Closes #
Fixes #
Related to #

📸 Screenshots (if applicable)

Before After
Tabs visible only to Admin Tabs visible to Admin OR Users with specific permissions

🚀 Deployment Notes

  • No special deployment steps required
  • Database migration required
  • Configuration changes required
  • Environment variables updated

👥 Reviewers

Please review: @

📝 Additional Notes

The translate-locales.js script changes are dev-tooling only and do not affect the runtime application, but ensure language packs are accurate for the release.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
config-helpers 79.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@overtrue overtrue merged commit c3bfd2d into main Jan 29, 2026
16 checks passed
@overtrue overtrue deleted the refactory/bucketsetting branch January 29, 2026 12:05
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