User Data Package
The User Data Package is a Python module that provides an interface for managing user information and settings on a Windows system. It allows you to retrieve the current user's name, manage user permissions, and handle user preferences effectively.
Features
- Retrieve the current user's name.
- Access user permissions (e.g., check if the user is an admin).
- Manage user settings stored in a configuration file (INI format).
- Easily extendable to add more user-related functionalities.
Installation
-
Clone the repository or download from PyPi:
git clone https://github.com/aidmet/user_data.git
cd users
-
No additional dependencies are required for this package as it uses built-in libraries.
Usage
Here's how to use the users
package:
from users import get_current_user_name, User
from users.permissions import UserPermissions
from users.settings import UserSettings
username = get_current_user_name()
user = User(username)
permissions = UserPermissions(user)
print(f"Is {user.get_username()} an admin? {permissions.is_admin()}")
print(f"Privileges: {permissions.get_user_privileges()}")
user_settings = UserSettings(user)
user_settings.set_setting('theme', 'dark')
theme = user_settings.get_setting('theme', 'light')
print(f"User theme setting: {theme}")
Testing
The package includes a set of unit tests to ensure functionality. To run the tests:
- Navigate to the project directory.
- Run the following command:
python -m unittest discover -s tests
Contributing
Contributions are welcome! If you have suggestions or improvements, please create an issue or submit a pull request.
- Fork the repository.
- Create your feature branch:
git checkout -b feature/YourFeature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/YourFeature
- Open a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Python - The programming language used.
- unittest - The built-in library for testing.