Removing Tenant Dropdown From User Form

    Yes, he can’t see admin user anymore, but something is wrong. When you click tenant2, nothing will happen and you’ll get an error “Can’t load script data: Lookup.Administration.Tenant“ in browser console:

    This error is not related to our recent filtering at repository level. It can’t load this lookup script, because current user has no permission to Tenants table. But how did he see it last time (in one case)?

    But this time, as we rebuild project, browser tried to load it from server, and we got this error, as tenant2 doesn’t have this permission. It’s ok, we don’t want him to have this permission, but how to avoid this error?

    We need to remove Tenant field from the user form. But we need that field for admin user, so we can’t simply delete it from UserForm.cs. Thus, we need to do it conditionally.

    Build the project, transform all templates and add method below to UserDialog.ts:

    Here we exclude TenantId field, if current user doesn’t have the tenants permission.

    This doesn’t modify the original user form, it just changes list for this dialog instance.

    User tenant2 can now open the user dialog.