Skip to main content

Updating users and groups

You can update basic properties of both users and groups, again using the builder pattern.

Update group

For example, to update a group:

Update a group
AtlanGroup group = AtlanGroup.updater( // (1)
"e79cb8eb-2bb6-4821-914c-f8dfd21fedc7", // (2)
"/example_group") // (3)
.attributes(AtlanGroup.GroupAttributes.builder() // (4)
.description(List.of("Now with a description!")) // (5)
.build()) // (6)
.build(); // (7)
group.update(client); // (8)
  1. To update a group, start a builder using the updater() method.
  2. You must provide the GUID of the group...
  3. ...and the path of the group you want to update. (Note that the path is different from the name—you're best retrieving a group first and then getting the path from that retrieved object if you are unsure.)
  4. You can then specify anything you want to update. In the case of a group, most of the properties are in an embedded attributes object that can be built-up through its own builder.
  5. For example, you can add or change the description of the group. (Note that all objects in the attributes of a group are lists, even when they only have a single value.)
  6. Like other builder patterns, you need to build the attributes object.
  7. Like other builder patterns, you need to build the updated group object itself.
  8. Finally, you can call the update() method on the built-up group object to actually update the group in Atlan. Note that this method doesn't return anything. Because this operation will persist the group in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Remove users from group

To remove one or more users from a group:

Remove users from a group
AtlanGroup group = AtlanGroup.updater( // (1)
"e79cb8eb-2bb6-4821-914c-f8dfd21fedc7", // (2)
"/example_group") // (3)
.build(); // (4)
group.removeUsers(client, List.of("da213751-95de-4f96-8bee-a2c73e2ef8c8")); // (5)
  1. To update group membership, start a builder using the updater() method.
  2. You must provide the GUID of the group...
  3. ...and the path of the group you want to update. (Note that the path is different from the name—you're best retrieving a group first and then getting the path from that retrieved object if you are unsure.)
  4. Like other builder patterns, you need to build the updated group object itself.
  5. Use the removeUsers() method to remove one or more users from the group. Specify the GUID of each user you want to remove as a member of the group. Because this operation will persist the group in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Update user

To update a user, begin by building the minimal update object:

Build the minimal update object
AtlanUser user = AtlanUser.updater( // (1)
"da213751-95de-4f96-8bee-a2c73e2ef8c8") // (2)
.build(); // (3)
  1. To update a user, start a builder using the updater() method.
  2. You must provide the GUID of the user.
  3. Like other builder patterns, you need to build the updated user object itself.

Add user to groups

Once you have the update object, to add a user to one or more groups:

Add user to groups
user.addToGroups(client, List.of("e79cb8eb-2bb6-4821-914c-f8dfd21fedc7")); // (1)
  1. Use the addToGroups() method to add the user to one or more groups. Specify the GUID of each group you want to make the user a member of. Because this operation will persist the user in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Change role of user

Once you have the update object, to change the role of a user:

Change role of user
user.changeRole(client, client.getRoleCache().getIdForName("$guest")); // (1)
  1. Use the changeRole() method to change the role of a user. Because this operation will persist the user in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

    Use the RoleCache to find the right GUID

The changeRole() method requires the GUID of the role you want to move the user to. In order to find that GUID, you can use the RoleCache.getIdForName() and provide the name of the role. :::

Deactivate user

This can't be done programmatically

You can only deactivate users as an Admin user (via the UI), API tokens don't have access to deactivate users.

Reactivate user

This can't be done programmatically

You can only reactivate users as an Admin user (via the UI), API tokens don't have access to reactivate users.

Was this page helpful?