macOS command line tool example of using Collaboration Framework's Identity classes using Swift. Inspiration and partial port of Privileges' MTIdentity class
$ ./identity
identity: macOS command line utility that checks users group memberships and group guids
Usage:
identity <group_name> Get gid based on group name
identity <user_name> <gid> Check (true/false) if user belongs to a group
You can test the tool by listing macOS's users and groups using these commands:
$ dscl . list /users
$ dscl . list /groups
Examples:
./identity admin
80
./identity myuser 80
true
./identity nonexistent
No such group