4.2. Managing groups with IdM API commands
The examples below show common scenarios of how you can manage IdM groups with the IdM API commands.
- Creating an IdM group
In this example, you create an IdM group
developers, with a specified Group ID number.api.Command.group_add("developers", gidnumber=500, description="Developers")- Adding a user as a member to an IdM group
In this example, you add the
adminuser to thedevelopersgroup.api.Command.group_add_member("developers", user="admin")- Adding a service as a member to an IdM group
In this example, you add the
HTTP/server.ipa.testservice to thedevelopersgroup.api.Command.group_add_member("developers", service="HTTP/server.ipa.test")- Adding a group as a subgroup to an IdM group
In this example, you add another group,
admins, to thedevelopersgroup.api.Command.group_add_member("developers", group="admins")- Adding IdM group managers
In this example, you add the
bobuser as a group manager for thedevelopersgroup.api.Command.group_add_member_manager("developers", user="bob")- Finding an IdM group
You can search for an IdM group using various parameters. In this example, you find all groups that the user
bobis managing.api.Command.group_find(membermanager_user="bob")- Displaying IdM group information
In this example, you display group information about the
developersgroup, without the members list.api.Command.group_show("developers", no_members=True)- Modifying an IdM group
In this example, you convert a non-POSIX group
testgroupto a POSIX group.api.Command.group_mod("testgroup", posix=True)- Removing members from an IdM group
In this example, you remove the
adminuser from thedevelopersgroup.api.Command.group_remove_member("developers", user="admin")- Removing IdM group managers
In this example, you remove the user
bobas a manager from thedevelopersgroup.api.Command.group_remove_member_manager("developers", user="bob")- Removing an IdM group
In this example, you remove the
developersgroup.api.Command.group_del("developers")