Add User Banning Functionality with bannedUntil Field #1225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add user banning functionality with
bannedUntil
field andisBanned
computed property to the User class.Changes Made ✅
Core Implementation
bannedUntil
field: Nullable String property to store ban expiration timestampisBanned
computed property: UTC-based validation to check if user is currently bannedbanned_until
from API responsesTechnical Details
Usage Example
Backend Requirements 🔄
This frontend implementation is ready but requires backend support:
banned_until timestamptz
column toauth.users
tablebanned_until
field in user object responsesDatabase Migration Needed:
Expected API Response Format:
Current Status
banned_until
field supportOnce backend adds the
banned_until
field to API responses, this feature will work automatically.Testing
The implementation includes robust error handling:
Compatibility
Next Steps
Seeking backend team collaboration to:
banned_until
columnThe client-side implementation is production-ready! 🚀
Files Changed
packages/gotrue/lib/src/types/user.dart
- Added bannedUntil field and isBanned method