Skip to content

Darkdragon14/ha-access-control-manager

Repository files navigation

Access Control Manager For Home Assistant

hacs_badge HA integration usage Hassfest HACS Action release

"Access Control Manager" provides a centralized interface for managing user permissions and access rights within Home Assistant. It allows administrators to create, assign, and customize roles, ensuring secure and streamlined control over who can interact with specific devices, automations, and dashboards in the smart home ecosystem.

Installation

HACS installation

Open your Home Assistant instance and open a repository inside HACS.

To install Access Control Manager using HACS:

  1. Click the button above, or add this repository manually as a custom repository in HACS:
    • Go to HACSIntegrationsAdd Custom Repository.
    • Enter the URL of this repository and select Integration as the category.
  2. Search for "Access Control Manager" in HACS and install it.
  3. Restart Home Assistant.
  4. Go to SettingsDevices & ServicesAdd Integration.
  5. Search for "Access Control Manager" and select it.

How it works

This section was added following this issue.

To set up custom access management, you need to follow these steps:

  1. Create a new group: Define a new group that will have specific permissions.
  2. Unassign the Users group: For the users you want to restrict, you must remove them from the default Users group. As explained in the Home Assistant developer documentation, policies are merged, and the Users group grants broad permissions by default. To apply restrictive policies, the user must not be a member of the Users group.
  3. Set permissions: Assign the desired permissions to the new group you have created.

Label permissions

The Label permissions section is a bulk-edit helper for entities, helpers, and devices that directly use a Home Assistant label. When you select read or write for a label, Access Control Manager applies that permission to the currently loaded matching entities and saves them as individual entity permissions.

This does not create a persistent Home Assistant label policy. If you add a new device or entity later and assign the same label to it, the new item will not automatically receive those permissions. Reopen the group permissions, apply the label permission again, and save to include new matching items.

Customizable options

Option Name Description required default Value
Tab Icon Icon for the Access Control Manager tab, chosen from 23 MDI icons No mdi:shield-account
Tab Name Name of the Access Control Manager tab. No Access Control Manager
Path for Admin UI Custom URL path for accessing the admin interface No /ha-access-control-manager

Public API: dashboard visibility sync

Access Control Manager exposes an async helper that other Home Assistant code can call to synchronize Lovelace dashboard visibility from the current ACM group dashboard permissions.

The helper is registered in hass.data when the integration is loaded:

from homeassistant.core import HomeAssistant

ACM_DOMAIN = "ha_access_control_manager"
SYNC_DASHBOARDS_API = "async_sync_group_dashboards_to_users"


async def async_update_dashboard_visibility(hass: HomeAssistant) -> None:
    sync_dashboards = hass.data.get(ACM_DOMAIN, {}).get(SYNC_DASHBOARDS_API)
    if sync_dashboards is None:
        raise RuntimeError("Access Control Manager is not loaded")

    await sync_dashboards(hass)

This coroutine must be awaited from Home Assistant's event loop. It does not take a user or group argument; it syncs dashboard visibility for users based on the saved ACM group dashboard permissions.

Future improvements

  • Adding a message to confirm or display an error when we save 🚀

  • Search system to quickly find resources 🚀

  • Adding a function to sanitize url for path_to_admin_ui 🛠️

  • Improving error handling and code maintainability. 🛠️

Missing Translation

If you want this component to support another language, feel free to submit a PR or create an issue. If you open an issue, I’ll gladly handle the translation for you! 😄

Contributors

See CONTRIBUTORS.md for the full list of contributors.

About

"Access Control Manager" provides a centralized interface for managing user permissions and access rights within Home Assistant. It allows administrators to create, assign, and customize roles, ensuring secure and streamlined control over who can interact with specific devices, automations, and dashboards in the smart home ecosystem.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors