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.


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.