Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions docs/USER_GROUP_MGMT.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
# GD User Group Management

This tool facilitates the management of user groups within a GoodData organization. It supports the creation, updating, and deletion of user groups, including the assignment of parent user groups as defined in the input details.

## Usage

The tool requires the following argument:

- `user_group_csv` - a path to a CSV file that defines the user groups, their names, parent user groups, and active status.

Optional arguments include:

- `-d | --delimiter` - column delimiter for the CSV files. This defines how the CSV is parsed. The default value is "`,`".
- `-u | --ug_delimiter` - delimiter used to separate different parent user groups within the parent user group column. This must differ from the "delimiter" argument. Default value is "`|`".
- `-q | --quotechar` - quotation character used to escape special characters (such as the delimiter) within the column values. The default value is '`"`'. If you need to escape the quotechar itself, you have to embed it in quotechars and then double the quotation character (e.g.: `"some""string"` will yield `some"string`).

Use the tool like so:

```sh
python scripts/user_group_mgmt.py user_group_csv
```

Where `user_group_csv` refers to the input CSV file.

For custom delimiters, use the command:

```sh
python scripts/user_group_mgmt.py user_group_csv -d "," -u "|"
```

To display help for using arguments, run:

```sh
python scripts/user_group_mgmt.py -h
```

## Input CSV File (`user_group_csv`)

The input CSV file defines the user groups to be managed. User groups not defined in the input file will not be modified.

[Example input CSV.](examples/user_group_mgmt/input.csv)

Expected CSV format:

| user_group_id | user_group_name | parent_user_groups | is_active |
|----------------|------------------|--------------------|-----------|
| ug_1 | Admins | | True |
| ug_2 | Developers | ug_1 | True |
| ug_3 | Testers | ug_1, ug_2 | True |
| ug_4 | TemporaryAccess | ug_2 | False |
| user_group_id | user_group_name | parent_user_groups | is_active |
| ------------- | --------------- | ------------------ | --------- |
| ug_1 | Admins | | True |
| ug_2 | Developers | ug_1 | True |
| ug_3 | Testers | ug_1, ug_2 | True |
| ug_4 | TemporaryAccess | ug_2 | False |

Here, each `user_group_id` is the unique identifier for the user group.

The `user_group_name` field is an optional name for the user group, defaulting to the ID if not provided.

The `parent_user_groups` field specifies the parent user groups, defining hierarchical relationships.

The `is_active` field contains information about whether the user group should exist or be deleted from the organization. The `is_active` field is case-insensitive, recognizing `true` as the only affirmative value. Any other value is considered negative (e.g., `no` would evaluate to `False`).

This documentation provides a comprehensive guide to using the GD User Group Management tool effectively within your GoodData organization.
The `is_active` field holds boolean values containing information about whether the user group should exist or be deleted from the organization.
12 changes: 10 additions & 2 deletions docs/USER_MGMT.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
# GD User Management

Tool which helps manage user entities in an GoodData organization.

Users can be created, updated, and deleted. This includes creation of any new userGroups which would be provided in user details.

## Usage

The tool requires the following argument on input:

- `user_csv` - a path to a csv file defining user entities, their relevant attributes, userGroup memberships, and isActive state

Some other, _optional_, arguments are:

- `-d | --delimiter` - column delimiter for the csv files. Use this to define how the csv is parsed. Default value is "`,`"
- `-u | --ug_delimiter` - userGroups column value delimiter. Use this to separate the different userGroups defined in the userGroup column. Default value is "`|`". Note that `--delimiter` and `--ug_delimiter` have to differ.
- `-q | --quotechar` - quotation character used to escape special characters (such as the delimiter) within the column field value. Default value is '`"`' If you need to escape the quotechar itself, you have to embed it in quotechars and then double the quotation character (e.g.: `"some""string"` will yield `some"string`).

Use the tool like so:

```sh
python scripts/user_mgmt.py user_csv
```

Where `user_csv` refers to input csv.

If you would like to define custom delimiters, use the tool like so:

```sh
python scripts/user_mgmt.py user_csv -d "," -u "|"
```

To show the help for using arguments, call:

```sh
python scripts/user_mgmt.py -h
```

## Input CSV file (user_csv)

The input CSV file defines the user entities which you might want to manage. Note that GD organization users that are not defined in the input will not be modified in any way.

[Example input csv.](examples/user_mgmt/input.csv)

Following format of the csv is expected:

| user_id | firstname | lastname | email | auth_id | user_groups | is_active |
|----------------------|-----------|----------|-------------------------|-----------|-------------|-----------|
| -------------------- | --------- | -------- | ----------------------- | --------- | ----------- | --------- |
| jozef.mrkva | jozef | mrkva | jozef.mrkva@test.com | auth_id_1 | | True |
| bartolomej.brokolica | | | | | | False |
| peter.pertzlen | peter | pertzlen | peter.pertzlen@test.com | auth_id_3 | ug_1, ug_2 | True |
Expand All @@ -52,4 +60,4 @@ The `firstname`, `lastname`, `email`, and `auth_id` fields are optional attribut

The `user_groups` field specifies user group memberships of the user.

Lastly, the `is_active` field contains information about whether the user should or should not exist in the organization. The `is_active` field is case-insensitive and considers `true` as the only value taken as positive. Any other value in this field is considered negative (e.g.: `blabla` would evaluate to `False`).
Lastly, the `is_active` field holds boolean values containing information about whether the user should or should not exist in the organization.
Loading