Skip to content

Commit f579fbd

Browse files
authored
v1.0 Release (#1)
## v1.0.0 - 2024-02-28 ### Added - `User()` class which contains user details - `primary()` function to supersede `console()` - `admins()` function to return a list of admin `User()` - `group_member()` function to check if a user is in a group - `fv_access()` function to check if a user has FileVault access - `apfs_owner()` function to check if a user is an APFS volume owner - `secure_token_status()` function to check if the user has a secure token - `users()` function can now filter by primary group IDs - This changelog ### Changed - `users()` now finds users by finding users with a shell - `users()` now returns a list of User class - Deprecated `console()` function, use `primary()`.username for similar functionality ### Fixed - `users()` now returns more than just "root"
1 parent 47e1b4a commit f579fbd

File tree

4 files changed

+444
-48
lines changed

4 files changed

+444
-48
lines changed

README.md

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,58 @@
11
# macusers
2-
Get the macOS console username and/or a list of local non-system users.
2+
3+
Get details on macOS user accounts.
34

45
```python
56
>>> import macusers
6-
>>> macusers.console()
7+
# get the logged in user details.
8+
>>> user = macusers.primary()
9+
# get the logged in user's username.
10+
>>> user.username
711
'bryanheinz'
8-
>>> macusers.users()
9-
['root', 'bryanheinz']
10-
>>> macusers.users(False)
11-
['bryanheinz']
12+
# get logged in user's home folder as a `pathlib` object.
13+
>>> user.home
14+
PosixPath('/Users/bryanh')
15+
# get a list of non-system user accounts.
16+
>>> for user in macusers.users(False): print(user.username)
17+
bryanheinz
18+
morrismoss
19+
# get a list of admin accounts.
20+
>>> for admin in macusers.admins(False): print(admin.username)
21+
bryanheinz
22+
# check if the user has FileVault access. NOTE: requires admin.
23+
>>> macusers.primary().fv_access()
24+
True
25+
# check if the user is an APFS volume owner.
26+
>>> macusers.primary().apfs_owner()
27+
True
28+
# check if the user has a secure token.
29+
>>> macusers.primary().secure_token_status()
30+
True
1231
```
1332

14-
This module is used to get the current or last (if the system currently doesn't have any logged in users) logged in console user on macOS instead of the user running the script/program. This module can also return a list of all local non-system created users.
33+
This module is used to get the current or last (if the system currently doesn't have any logged in users) logged in console user on macOS instead of the user running the script/program.
34+
35+
This module now contains the following User properties:
36+
37+
- username : The user's username
38+
- real_name : Full name
39+
- uid : The user's ID
40+
- gid : Primary group ID
41+
- guid : Generated user ID - used by APFS
42+
- home : Home folder
43+
- shell : Default shell
44+
- admin : If the user is an admin
45+
- ssh_access : If the user has SSH access
46+
- volume_owner : If the user is an APFS volume owner
47+
- secure_token : If the user has a secure token
48+
- created : Epoch time when the user was created
49+
- password_updated: Epoch time when the user's password was last changed
50+
51+
These properties can be accessed via `User.PROPERTY` e.g. `macusers.primary().admin`.
1552

1653
## Installing
1754
You can install macusers using pip. macusers has been tested with Python 3.7 and 3.9.
1855

1956
```console
20-
> python3 -m pip install macusers
57+
python3 -m pip install macusers
2158
```

changelog.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project attempts to adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## v1.0.0 - 2024-02-28
9+
10+
### Added
11+
12+
- `User()` class which contains user details
13+
- `primary()` function to supersede `console()`
14+
- `admins()` function to return a list of admin `User()`
15+
- `group_member()` function to check if a user is in a group
16+
- `fv_access()` function to check if a user has FileVault access
17+
- `apfs_owner()` function to check if a user is an APFS volume owner
18+
- `secure_token_status()` function to check if the user has a secure token
19+
- `users()` function can now filter by primary group IDs
20+
- This changelog
21+
22+
### Changed
23+
24+
- `users()` now finds users by finding users with a shell
25+
- `users()` now returns a list of User class
26+
- Deprecated `console()` function, use `primary()`.username for similar functionality
27+
28+
### Fixed
29+
30+
- `users()` now returns more than just "root"
31+
32+
## v0.0.3 - 2021-02-05
33+
34+
Initial release

0 commit comments

Comments
 (0)