@@ -115,8 +115,7 @@ class AuthService {
115115 user = User (
116116 id: _uuid.v4 (), // Generate new ID
117117 email: email,
118- isAnonymous: false , // Email verified user is not anonymous
119- isAdmin: false ,
118+ role: UserRole .standardUser, // Email verified user is standard user
120119 );
121120 user = await _userRepository.create (item: user); // Save the new user
122121 print ('Created new user: ${user .id }' );
@@ -155,9 +154,8 @@ class AuthService {
155154 try {
156155 user = User (
157156 id: _uuid.v4 (), // Generate new ID
158- isAnonymous : true ,
157+ role : UserRole .guestUser, // Anonymous users are guest users
159158 email: null , // Anonymous users don't have an email initially
160- isAdmin: false ,
161159 );
162160 user = await _userRepository.create (item: user);
163161 print ('Created anonymous user: ${user .id }' );
@@ -248,7 +246,7 @@ class AuthService {
248246 required User anonymousUser,
249247 required String emailToLink,
250248 }) async {
251- if (! anonymousUser.isAnonymous ) {
249+ if (anonymousUser.role != UserRole .guestUser ) {
252250 throw const BadRequestException (
253251 'Account is already permanent. Cannot link email.' ,
254252 );
@@ -310,7 +308,7 @@ class AuthService {
310308 required String codeFromUser,
311309 required String oldAnonymousToken, // Needed to invalidate it
312310 }) async {
313- if (! anonymousUser.isAnonymous ) {
311+ if (anonymousUser.role != UserRole .guestUser ) {
314312 // Should ideally not happen if flow is correct, but good safeguard.
315313 throw const BadRequestException (
316314 'Account is already permanent. Cannot complete email linking.' ,
@@ -335,8 +333,7 @@ class AuthService {
335333 final updatedUser = User (
336334 id: anonymousUser.id, // Preserve original ID
337335 email: linkedEmail,
338- isAnonymous: false , // Now a permanent user
339- isAdmin: false ,
336+ role: UserRole .standardUser, // Now a permanent standard user
340337 );
341338 final permanentUser = await _userRepository.update (
342339 id: updatedUser.id,
0 commit comments