Skip to content

Commit f038b3a

Browse files
committed
fix(auth): update user role checks and registration output
- Change role check to use dashboardRole instead of roles list - Update new user creation output to show appRole instead of roles - Improve code readability by using separate lines for output messages
1 parent 3af92e3 commit f038b3a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/src/services/auth_service.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ class AuthService {
7373
);
7474
}
7575

76-
final hasRequiredRole =
77-
user.roles.contains(UserRoles.admin) ||
78-
user.roles.contains(UserRoles.publisher);
76+
final hasRequiredRole = user.dashboardRole == DashboardUserRole.admin ||
77+
user.dashboardRole == DashboardUserRole.publisher;
7978

8079
if (!hasRequiredRole) {
8180
print(
@@ -185,7 +184,9 @@ class AuthService {
185184
),
186185
);
187186
user = await _userRepository.create(item: user);
188-
print('Created new user: ${user.id} with roles: ${user.roles}');
187+
print(
188+
'Created new user: ${user.id} with appRole: ${user.appRole}',
189+
);
189190

190191
// Create default UserAppSettings for the new user
191192
final defaultAppSettings = UserAppSettings(id: user.id);

0 commit comments

Comments
 (0)