Entity as User Object to be used as login

Hi,

I’m looking to create an entity and this entity should be as User object in addition of its own functionalities.

I have an entity called Factory, and there I store all factories, where I have different information about the factory + login credentials, where a representer can connect with some pre-generated factory credentials.
And I have normal users and they can belong to different Access Group/Role, but they have no extended view of the User entity as Factory should have.

Do you have any idea how I can do this ?

Could you explain how you see the login process?
In the login screen, the user selects a factory and enters login/name for it, or just logs in with his own credentials?

Hi Konstantin,

Thanks for your response.

Factory is kind himself a user, where you create a give a unique credential.
The entity will have some extra fields + some User fields.
When Admin creates a Factory, he will be able to give a default password and email to him (like in the User entity)

The app can host other normal users, like admin, supervisors etc… not related to Factory

Hi Gent,

In ordere to suggest anything, I need to understand a bit more about your intention. So how do you want to use these factories/users?

Hi Konstantin,

Factory entity contains different information related to its identification (position, name, address, code etc…) and user credentials.
Admin users, can add factory and create credential, so factory user can login.

This factory once is logged in, can claim a “Deviation” which is a form to submit and can see only his submitted forms.
On the other hand admin (who is a normal Cuba User with admin role) can see all submitted from anyone.

My idea was to crate a Factory entity which extends pre-built User entity.
Other solution would be to create a Factory entity which has a User parm. but then the user need to be created first then attached to the Factory which makes things a bit more complicated when you bulk upload all factories who should be able to connect.

Any suggestion from your side ?

> My idea was to crate a Factory entity which extends pre-built User entity.

> Other solution would be to create a Factory entity which has a User parm. but then the user need to be created first then attached to the Factory which makes things a bit more complicated when you bulk upload all factories who should be able to connect.

Both approaches are valid. I would prefer the first one if I would need just a slight modification of the standard User, e.g. adding a few fields. The second approach gives you full freedom and the linked entity can be whatever complex.

If you have any trouble with the concrete implementation code (e.g. with programmatic creation of the linked entities), feel free to ask and share the problematic code or test project.

1 Like

Hi Konstantin,

Thanks your your suggestions!

For now I preferred to go with option 2, since it’s easier from the dev perfective.
For Bulk uploads, I will let the admin user to upload Factories first and ask to do the attachment with users using the UI.