Difference between User and UserMT, User_Role entity

Hi All,

As I was working on system entity, I saw User entity and UserMT. Even if there is very little difference which is I am suppose to use.

While using User_Role, in one application I used User_Role entity which had Tenant _Id as well along with RoleId and UserId. But now I am unable to use it.

 Kindly let me know how I get it


Hello Ankita.

All entities have a discription.

The normal user table is USER.

USERMT is a view for MultiTenancy.

USER_ROLE is a N to N table that connects USER and ROLE.


Can you explain why you need to use the User_Role? What are you trying to do?

Hi Ankita,

User contains a record for each registered user that can access an OutSystems application.

User_Role contains the roles that are assigned to a user, and allows for role-based authentication of screens, processes & logic. 

Groups can be used to assign roles to, and then you can a user to one or more groups.

User_Effective_Role will have all the Roles for the User. The ones attributed directly and the ones attributed through the Groups.

UserMT is a view over the User table. The difference is if you query User you will get only the users from the current tenant while UserMT will return all the users from all the tenants.

See also:

https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/Users_API

Regards,

Daniel

Hi Ankita,

The difference between User and UserMT is that User is specific to a tenant in given context while UserMT has all the tenants. You should stick to User entity for your normal operations for the given tenant. What is the issue you are facing while using User_Role?

Daniël Kuhlmann wrote:

Hi Ankita,

User contains a record for each registered user that can access an OutSystems application.

User_Role contains the roles that are assigned to a user, and allow for role-based authentication of screens, processes & logic. 

Groups can be used to assign roles to, and then you can a user to one or more groups.

User_Effective_Role will have all the Roles for the User. The ones attributed directly and the ones attributed through the Groups.

UserMT is a view over the User table. The difference is if you query User you will get only the users from the current tenant while UserMT will return all the users from all the tenants.

Regards,

Daniel

Thank you Daniel, pretty detailed and useful.


Nuno Reis wrote:

Hello Ankita.

All entities have a discription.

The normal user table is USER.

USERMT is a view for MultiTenancy.

USER_ROLE is a N to N table that connects USER and ROLE.


Can you explain why you need to use the User_Role? What are you trying to do?

Hi Nuno,

I am trying to develop a back office where I manage users role.

I need to add Tenant_Id in User_Role Entity so that I will be able to filter wrt Tenant Id as well.I want entity something like this.


First rule of OutSystems: don't mess system entities.

Even if you added TenantId, User+Role are a unique Index in User_Role, so you would need to change that.


You can have tenant-specific users that will only have those roles inside their tenant.

And you can try to have some multi-tenant users with identical permissions across all tenants.

Don't try to mix that or it will get worse fast.

I'd advise you to read this (is long)

https://success.outsystems.com/Support/Enterprise_Customers/Maintenance_and_Operations/How_to_Build_a_Multi-tenant_Application

Then watch this

https://www.outsystems.com/learn/courses/45/master-class-on-multi-tenancy/


And finally look at this component that probably does what you want.

https://www.outsystems.com/forge/Component_Overview.aspx?ProjectId=461

If not, it can help you understand what you need to do.,


Hi Nuno,

Thankyou. I will have a look at these links.