feat: Update API endpoint usage in repositories to remove redundant path property
- Refactored multiple repository implementations across client and staff features to directly use endpoint objects without accessing the `path` property. - Introduced a new `FeatureGate` class for client-side feature gating based on user scopes, allowing for better access control to API endpoints. - Added `ApiEndpoint` class to represent API endpoints with their paths and required scopes for future feature gating.
This commit is contained in:
@@ -330,3 +330,22 @@ class NotAuthenticatedException extends AppException {
|
||||
@override
|
||||
String get messageKey => 'errors.auth.not_authenticated';
|
||||
}
|
||||
|
||||
/// Thrown when the user lacks the required scopes to access an endpoint.
|
||||
class InsufficientScopeException extends AppException {
|
||||
/// Creates an [InsufficientScopeException].
|
||||
const InsufficientScopeException({
|
||||
required this.requiredScopes,
|
||||
required this.userScopes,
|
||||
super.technicalMessage,
|
||||
}) : super(code: 'SCOPE_001');
|
||||
|
||||
/// The scopes required by the endpoint.
|
||||
final List<String> requiredScopes;
|
||||
|
||||
/// The scopes the user currently has.
|
||||
final List<String> userScopes;
|
||||
|
||||
@override
|
||||
String get messageKey => 'errors.generic.insufficient_scope';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user