Authorization

D-Bus authorization mixin for interface classes.

class DBusAuthorizationMixin[source]

Mixin class providing D-Bus caller authorization functionality.

_get_caller_unix_user_id(sender)[source]

Get the Unix user ID of the D-Bus caller.

Return type:

int

Parameters:

sender – The D-Bus sender.

Returns:

The Unix user ID of the caller.

Return type:

int

Raises:

PermissionError – If caller information cannot be retrieved.

_verify_internal_user_authorization(sender, requested_user_id, session_manager)[source]

Verify that the caller is authorized to access the requested internal user’s data.

Return type:

None

Parameters:
  • sender – The D-Bus sender.

  • requested_user_id (str) – The internal user ID being requested.

  • session_manager – UserSessionManager instance for user ID conversion.

Raises:

PermissionError – If the caller’s user ID doesn’t match the requested user ID.

_verify_unix_user_authorization(sender, requested_unix_user_id)[source]

Verify that the caller’s Unix user ID matches the requested Unix user ID.

Return type:

None

Parameters:
  • sender – The D-Bus sender.

  • requested_unix_user_id (int) – The Unix user ID being requested.

Raises:

PermissionError – If the caller’s Unix user ID doesn’t match the requested user ID.