Why in user-registration sample you set role both manually and by default?


(Rulesprog) #1

Why in sample-user-registration you have User.isDefaultRole set to true in init scripts https://github.com/cuba-platform/sample-user-registration/blob/87f6bdecbb88a390ba08253145ed61a8a78072a3/modules/core/db/init/hsql/30.create-db.sql#L3
Then in https://github.com/cuba-platform/sample-user-registration/blob/87f6bdecbb88a390ba08253145ed61a8a78072a3/modules/core/src/com/company/sample/service/RegistrationServiceBean.java#L50
you apply User role to newly created user. When I did so in postgesql I understood that if User.isDefaultRole is set to true then this action is performed automatically for every new user and if I addidtionally perform this action from java as you do in sample I get idx_sec_user_role_uniq_role constarint violation.
So I believe you must either set User.isDefaultRole to false and apply User role to new user through java Or set User.isDefaultRole to true and platform will perform it automatically… But not both at the same time as you did. Am I wrong?


How to set up user-registration sample with PostgreSQL
(Yuriy Artamonov) #3

I belive this sample in the first version did not have this flag set as true. Probably, just a small bug in the sample.