Colin Mackie - 18 - Mar 27, 2015

Is there a preferred way to delete a user from an IAuthRepository,?

There isn’t an API for this, what AuthProvider impl are you using?

Colin Mackie:

A bunch of OAuth ones and a CredentialsAuthProvider in OrmLite. Just came across a need to remove a user and couldn’t see an obvious way to do it.

My mistake, I mean which AuthProviderRepo are you using?

Colin Mackie:

OrmLiteAuthRepository

You can just use OrmLite to delete the userAuth rows, e.g:

db.Delete<UserAuth>(x => x.Id == userId);
db.Delete<UserAuthDetails>(x => x.UserAuthId == userId);

and if you have any roles:

db.Delete<UserAuthRole>(x => x.UserAuthId == userId);

Colin Mackie:

Ok, thanks. Glad I wasn’t missing something. Will that change? Seems that the logic and structure of the auth tables shouldn’t be outside of the auth classes and have to be manipulated directly.

Yep, just added new DeleteUserAuth() for existing Auth Repo’s in this commit: https://github.com/ServiceStack/ServiceStack/commit/242b10fc0f8d6735d3e832ecbd34b17f3a3b94ea

This change just finished deploying to MyGet: https://github.com/ServiceStack/ServiceStack/wiki/MyGet