qgis_deployment_toolbelt.utils.user_groups module¶
Utilities to manage user security groups either on Linux and Windows.
Author: Julien Moura (https://github.com/guts)
- qgis_deployment_toolbelt.utils.user_groups.get_user_active_directory_object() pyad.ADUser | None ¶
Get user as an Active Directory object.
- Returns:
user object or None if something went wrong
- Return type:
pyad.ADUser | None
- qgis_deployment_toolbelt.utils.user_groups.get_user_domain_groups(user_guid_or_name: str | None = None) list[str] ¶
Lists the domain groups to which the user belong.
- On Linux and MacOS, it always return an empty list. TODO: implement it (probably
using pure LDAP).
On Windows, it relies on win32net (COM).
- Parameters:
user_guid_or_name (str | None, optional) – name of user. If None, the current user name is used. Defaults to None.
- Raises:
NotImplementedError – if operating system is not supported.
- Returns:
sorted list of unique groups names
- Return type:
- qgis_deployment_toolbelt.utils.user_groups.get_user_local_groups(user_name: str | None = None) list[str] ¶
Lists the local groups to which the user belong.
On Linux and MacOS, it relies on the grp module (only available). On Windows, it relies on win32net (COM).
- Parameters:
user_name (str | None, optional) – name of user. If None, the current user name is used. Defaults to None.
- Raises:
NotImplementedError – if operating system is not supported.
- Returns:
sorted list of unique groups names
- Return type:
- qgis_deployment_toolbelt.utils.user_groups.get_user_name_or_guid() str ¶
Get user GUID or name as fallback.
- Returns:
user GUID or name (getpass.getuser())
- Return type:
- qgis_deployment_toolbelt.utils.user_groups.is_computer_attached_to_a_domain() bool ¶
Determine if the computer is attached to a domain or not.
On Linux and MacOS, it always return False. On Windows, it tries to use wmi (Windows Management Instrumentation), Active
Directory (through pyad) or subprocessed powershell as final fallback.
- Raises:
NotImplementedError – if operating system is not supported.
- Returns:
True if the computer is attached to a domain.
- Return type: