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.
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 yieldsome"string
).
Use the tool like so:
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:
python scripts/user_mgmt.py user_csv -d "," -u "|"
To show the help for using arguments, call:
python scripts/user_mgmt.py -h
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.
Following format of the csv is expected:
user_id | firstname | lastname | auth_id | user_groups | is_active | |
---|---|---|---|---|---|---|
jozef.mrkva | jozef | mrkva | [email protected] | auth_id_1 | True | |
bartolomej.brokolica | False | |||||
peter.pertzlen | peter | pertzlen | [email protected] | auth_id_3 | ug_1, ug_2 | True |
zoltan.zeler | zoltan | zeler | [email protected] | auth_id_4 | ug_1 | True |
kristian.kalerab | kristian | kalerab | auth_id_5 | True | ||
richard.cvikla | [email protected] | auth_id_6 | ug_1, ug_2 | False | ||
adam.avokado | auth_id_7 | False |
Here, each user_id
is the ID of the user to manage.
The firstname
, lastname
, email
, and auth_id
fields are optional attributes of the user.
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
).