# Copyright (C) 2023 Canonical Ltd. # Author: Benjamin Drung <benjamin.drung@canonical.com> # SPDX-License-Identifier: GPL-2.0-or-later """Functions around users and groups.""" import dataclasses import os @dataclasses.dataclass() class UserGroupID: """Pair of user and group ID.""" uid: int gid: int def is_root(self) -> bool: """Check if the user or group ID is root.""" return self.uid == 0 or self.gid == 0 def get_process_user_and_group() -> UserGroupID: """Return the current process’s real user and group.""" return UserGroupID(os.getuid(), os.getgid())
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
crashdb_impl | Folder | 0755 |
|
|
REThread.py | File | 2.24 KB | 0644 |
|
__init__.py | File | 1.65 KB | 0644 |
|
crashdb.py | File | 32.56 KB | 0644 |
|
fileutils.py | File | 17.74 KB | 0644 |
|
hookutils.py | File | 34.82 KB | 0644 |
|
packaging.py | File | 12.17 KB | 0644 |
|
packaging_impl.py | File | 70.63 KB | 0644 |
|
report.py | File | 67.57 KB | 0644 |
|
sandboxutils.py | File | 10.99 KB | 0644 |
|
ui.py | File | 73.69 KB | 0644 |
|
user_group.py | File | 611 B | 0644 |
|