freeipa/doc/api/group_management.md
Antonio Torres a2667b249e API doc: add usage guides for groups, HBAC and sudo rules
Include guides with examples for groups, HBAC and sudo rules management.
These cover most of available commands related to these topics.

Signed-off-by: Antonio Torres <antorres@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2023-02-08 14:20:38 -05:00

2.2 KiB

Group management examples

This guide provides various examples on how to perform common tasks related to group management in a IPA environment making use of the provided API.

Creating a group

Create a group for developers, with an specific Group ID number.

api.Command.group_add("developers", gidnumber=500, description="Developers")

Adding members to a group

Add the admin user to the developers group.

api.Command.group_add_member("developers", user="admin")

Apart from users, groups can also have services and groups as members:

api.Command.group_add_member("developers", service="HTTP/server.ipa.test")
api.Command.group_add_member("developers", group="admins")

Adding group managers

Add bob as the group manager for developers group.

api.Command.group_add_member_manager("developers", user="bob")

Finding a group

Find all groups managed by bob.

api.Command.group_find(membermanager_user="bob")

Showing group information

Show information about the developers group, excluding the members list.

api.Command.group_show("developers", no_members=True)

Modifying a group

Convert a non-POSIX group to POSIX:

api.Command.group_mod("testgroup", posix=True)

Removing members from a group

Remove the admin user to the developers group.

api.Command.group_remove_member("developers", user="admin")

Removing group managers

Remove bob as the group manager from developers group.

api.Command.group_remove_member_manager("developers", user="bob")

Removing a group

Remove the developers group.

api.Command.group_del("developers")