loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Partitioning users with realms

Open chojowliu opened this issue 10 years ago • 3 comments

I love the function that loopback provided to partition users with realms, but is there anyway, I can use the same email address in different realms? I would like the same user ([email protected]) in realm "service" and also in realm "customer". Currently, I can add it directly into the database by using SQL, but when I try to use User.create(), I will keep getting err about email is being used.

https://docs.strongloop.com/display/public/LB/Partitioning+users+with+realms

chojowliu avatar Mar 22 '16 14:03 chojowliu

Unfortunately as listed in the link you posted.

A user or application can belong to only one realm.

I will list it as an enhancement feature.

0candy avatar Mar 22 '16 15:03 0candy

Thanks

As a workaround, do you foresee any problem if I use SQL code (maybe a store procedure) to create a new record in the User table with same email address just different realm? Will it cause the problem in any other part of the system? I currently manually enter the record by myself (go directly using sql tool), it looks okay so far.

On Tue, Mar 22, 2016 at 10:31 AM, Candy [email protected] wrote:

Unfortunately as listed in the link you posted.

A user or application can belong to only one realm.

I will list it as a feature enhancement.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/strongloop/loopback/issues/2159#issuecomment-199867306

Best Regard,

CJ Liu

chojowliu avatar Mar 22 '16 15:03 chojowliu

This is an issue which has to address. But as a workaround you have to remove the validations on email/username properties. Then apply your customized validation on email/username to check uniqueness between realm+email and realm+username.

server/models/user.js module.exports = function(User) { delete User.validations.email; }

hishamjaved avatar Jan 04 '17 11:01 hishamjaved