New Auth - help needed

New auth is great.

Hopefully it will keep improving. I’d like to see group management as well and possibility to join users to groups. Similarly as it’s done in linux and unixes.

group definition: {
0: admin,
1: switch_access,
2: media_access,
3: hvac_access
}

user could then be a member of multiple groups:
groups = { 1, 2 }

Ofcourse this would require that currently viewing users groups would be accessible and usable that main view could change accordingly to user’s groups.

I think new lovelace ui could do this if user’s would have groups like described here…


Anyway, I am trying to do something while waiting for this feature- a bulk version: a binary component which could tell if currently viewing user is allowed for section, but this is really really difficult, even though I am trying to do this in a very simple way at the beginning.

One could create a simple version of my description as a 3rd party component, but to archieve this, information about current user would be necessary. My first attempt would be making a detection for owner/admin user, but I am having difficulties to get any information about current user, even getting just username would be great, but I just don’t seem to find a way to get it.

I’d be greatful for help on this matter.

Maybe it would be easier if each user where redirected to the own home page without the side panel. This way they only would have access to what the admin set on their page.

That indeed would be even better… But sounds a lot of changes to current system and therefore we are quite far away from construct like that…

The login user (current user) is about the front end, the server back end can only know the current user, when there is a HTTP request presents. There are several way to get current user, from request, you can get it from request['hass_user'] if you are in a HTTPView.

We recently introduced a concept Context, all state will include Context information which included user_id.

Hope it helps you.