User Management Roles

I just deployed a new app and am trying to make it self-sufficient to the users. I am having two issues with the user management component.

I have configured the user management component to filter the roles to the roles for the app using:

if "Environment" in role:
   return 1
else:
   return 0

This is working well, but some users have rights to multiple applications… I am finding that if the user is modified through the user management component, any filtered roles in the background that they were assigned get wiped out and they loose their access to other projects! Is there a way to get around this?

Also, how can I prevent the user management component from being able to delete users? I only want add & edit buttons enabled.

Unfortunately, neither of these problems can currently be solved with the User Management Component currently. You could of course create your own screen to Add/Edit the current users with whatever spec you want. This will all be very easy if you are using a database Authentication source.